Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

c code 'onboard clcok'

I'm using the example c-codes that can be downloaded with the daqmxbase driver. I work on a linux machine and I have four pressure transducers with analog output signal. Now the example codes work really good with little changes made. When I use the contacquireNchan.c code, changing the sampling rate does not seem to change the number of readouts we get. 

For example, when I set the while loop to run only for 1 sec and the sampling rate to be 250..... I'm supposed to get only 250 readings for each channel right?

But mysteriously, the code gives out two runs instead of 1 run even though the loop is only for 1 sec. Each run also has 500 output readins instead of 250.

When I compile and run the code again and again, I keep on getting different number of readings, sometimes 500 sometimes 1000 etc....

I believe there is something I've not identified. Does anybody have any idea?

 

Also, I'm using the 'onboard clock' as the timing parameter, is it possible to get time as one output by itself? If so how?

 

Thanks

0 Kudos
Message 1 of 2
(5,282 Views)

Hey kichew,

Which version of the DAQmx drivers are you working with?  The closest example I find that matches your description is ContAcq-IntClk.c but this uses events to trigger a data read and does not poll the data like your method seems to be.  One thing to be careful of with software timed loops is that it is not guaranteed to run for exactly a second unless you are using a Deterministic Operating System.  So really the loop could be running for long enough to get more data from your device.  A useful resource for function descriptions (which you may have already found) is the NI-DAQmx Base C Function Reference and is installed in /usr/local/natinst/nidaqmxbase/documentation

Please post back with any additional questions 

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 2
(5,276 Views)