leh
2008-06-17 20:40:07 UTC
I own a NI-6259 board. I have used it with a WindowsXP and it worked fine.
Now, I have changed to a RedHat 4.6 Linux system.
My needs are simple: I don't want to use LabView, all I want
to do is to simple ANSI C functions. I downloaded nidaqmxbase-3.1.0.iso and installed it.
It works.
What I want to do is to run a feedback loop where I read four AI channels in,
make some calculations on the data and then write three AO channels out to my drivers.
The loop should run at 5 to 10 kHz.
I have been able to read the AI channels and write the AO channels separately but when I try to run them
simultaneously, it bombs.
The main part of the program looks like this:1 DAQmxErrChk (DAQmxBaseCreateTask("",&AOtaskHandle));2 DAQmxErrChk (DAQmxBaseCreateAOVoltageChan(AOtaskHandle,AOchan,"",AOmin,AOmax,DAQmx_Val_Volts,NULL));3 DAQmxErrChk (DAQmxBaseCfgSampClkTiming(AOtaskHandle,"",sampleRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,samplesPerChan));
4 DAQmxErrChk (DAQmxBaseCreateTask("",&AItaskHandle));5 DAQmxErrChk (DAQmxBaseCreateAIVoltageChan(AItaskHandle,AIchan,"",DAQmx_Val_Cfg_Default,AImin,AImax,DAQmx_Val_Volts,NULL));6 DAQmxErrChk (DAQmxBaseCfgSampClkTiming(AItaskHandle,"",sampleRate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,samplesPerChan));
7 DAQmxErrChk (DAQmxBaseStartTask(AItaskHandle));8 DAQmxErrChk (DAQmxBaseStartTask(AOtaskHandle));9 for(k=0;k<6;k++) {
10 DAQmxErrChk (DAQmxBaseReadAnalogF64 (AItaskHandle,samplesPerChan, timeout, 2, datain, bufferSize, &pointsRead, NULL));11 DAQmxErrChk (DAQmxBaseWriteAnalogF64(AOtaskHandle,samplesPerChan,0,timeout,2,dataout,&pointsWritten,NULL));
I get the following error message just after the first WriteAnalogF64 statement:
"DAQmxBase Error: The generation has stopped to prevent the regeneration of old samples. Your application was unable to write samples to the background buffer fast enough to prevent old samples from being regenerated. LavView caught fatal signal
8.2.1 - Received SIGSEGV Reason: address not mapped to object Attempt to reference address: 0xb4496500
Segmentation fault "
It looks like I got some serious timing problems. I need some advice
I'll attach the whole program for your information.
Lee Holloway
AI-AO.C:
http://forums.ni.com/attachments/ni/250/40890/1/AI-AO.C
Now, I have changed to a RedHat 4.6 Linux system.
My needs are simple: I don't want to use LabView, all I want
to do is to simple ANSI C functions. I downloaded nidaqmxbase-3.1.0.iso and installed it.
It works.
What I want to do is to run a feedback loop where I read four AI channels in,
make some calculations on the data and then write three AO channels out to my drivers.
The loop should run at 5 to 10 kHz.
I have been able to read the AI channels and write the AO channels separately but when I try to run them
simultaneously, it bombs.
The main part of the program looks like this:1 DAQmxErrChk (DAQmxBaseCreateTask("",&AOtaskHandle));2 DAQmxErrChk (DAQmxBaseCreateAOVoltageChan(AOtaskHandle,AOchan,"",AOmin,AOmax,DAQmx_Val_Volts,NULL));3 DAQmxErrChk (DAQmxBaseCfgSampClkTiming(AOtaskHandle,"",sampleRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,samplesPerChan));
4 DAQmxErrChk (DAQmxBaseCreateTask("",&AItaskHandle));5 DAQmxErrChk (DAQmxBaseCreateAIVoltageChan(AItaskHandle,AIchan,"",DAQmx_Val_Cfg_Default,AImin,AImax,DAQmx_Val_Volts,NULL));6 DAQmxErrChk (DAQmxBaseCfgSampClkTiming(AItaskHandle,"",sampleRate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,samplesPerChan));
7 DAQmxErrChk (DAQmxBaseStartTask(AItaskHandle));8 DAQmxErrChk (DAQmxBaseStartTask(AOtaskHandle));9 for(k=0;k<6;k++) {
10 DAQmxErrChk (DAQmxBaseReadAnalogF64 (AItaskHandle,samplesPerChan, timeout, 2, datain, bufferSize, &pointsRead, NULL));11 DAQmxErrChk (DAQmxBaseWriteAnalogF64(AOtaskHandle,samplesPerChan,0,timeout,2,dataout,&pointsWritten,NULL));
I get the following error message just after the first WriteAnalogF64 statement:
"DAQmxBase Error: The generation has stopped to prevent the regeneration of old samples. Your application was unable to write samples to the background buffer fast enough to prevent old samples from being regenerated. LavView caught fatal signal
8.2.1 - Received SIGSEGV Reason: address not mapped to object Attempt to reference address: 0xb4496500
Segmentation fault "
It looks like I got some serious timing problems. I need some advice
I'll attach the whole program for your information.
Lee Holloway
AI-AO.C:
http://forums.ni.com/attachments/ni/250/40890/1/AI-AO.C