07-28-2006 09:45 AM
I am using DAQPad-6016
(USB) and I am working on a controlling programm in ANSI-C. This
programm should read out digital ports from an angular encoder and
set voltage values to an analog output for a servo motor. (Some kind
of velocity control)
I found out how to compile an ANSI-C
programm with gcc under cygwin.
So what did was:
echo
EXPORTS > NIDAQmx.def
nm NIDAQmx.lib | grep ' T _' | sed 's/.*
T _//' >> NIDAQmx.def
dlltool -- def NIDAQmx.des --
dllname NIDAQmx.lib --output-lib NIDAQmx.a
After
I had written the code in myProg.c
I compiled in this way :
gcc -o
myProg.exe myProg.c -L./ -lNIDAQmx
I
created a software loop which realizes single state enquiries on
digital input ports. This method works fine with slow revolution
speed. But if I increase the motor speed, the data acquisition of
single state enquiries became to slow (8ms per loop). This was the
moment when I decided to measure hardware-sampled bit sequences.
I
created functions to initialize tasks and to start them. Therefore, I
used the examples of the NI folders as
templates:
initialize(){
...
DAQmxErrChk
(DAQmxCreateTask("",¤tTaskNumber));
DAQmxErrChk
(DAQmxCreateDIChan(currentTaskNumber,usedDIPort,"",DAQmx_Val_ChanForAllLines));
DAQmxErrChk
(DAQmxCfgSampClkTiming(currentTaskNumber,"",100.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,3));
DAQmxErrChk
(DAQmxStartTask(currentTaskNumber));
taskNumDIPort =
currentTaskNumber;
...
}
int
readPort(){
...
DAQmxErrChk
(DAQmxReadDigitalU32(taskNumDIPort,3,10.0,DAQmx_Val_GroupByChannel,lowByte,3,&numRead,NULL));
...
return
valueOfAngle;
}
These
functions work well - but only with out the
DAQmxCfgSampClkTiming
function.
However, I want to adjust these sample parameters for the
measurement. If I use this red line I get an ld linker error:
undefined
reference to `_DAQmxCfgSampClkTiming@28'
I
don't know if this problem depends on cygwin or not. Does anybody
know how to handle/solve this problem?
Thank you for your
attention and help!
Alex
09-01-2006 09:33 AM
09-15-2006 12:52 PM