08-15-2012 06:19 PM
Hi, I am trying to get started with nidaqmx 8.0.2 on Linux, using ansi c, and am a bit lost as to how I can log data to files. I've been looking at examples (e.g. in examples/ansi_c/AnalogIn/MeasureVoltage), but none seem to include what I need. Other posts have included references to TDMS examples in these directories, but those are missing for me.
Any advice on where to start would be most helpful!
-Melanie
08-15-2012 11:06 PM - edited 08-15-2012 11:07 PM
I set up an asychronous callback function to read continuous data. At 1Hz (your application requirements may vary), I write the data to a file.
So the example for analog input that refers to continuous voltage: Cont Acq-Int Clk
I have an array for all of the channels I'm reading, and I read 100 S at 1000 S/s. I then average the 100 S to get one data point. Though I get data at 10Hz, I only write it at 1Hz.
Good luck!
P.S. The examples don't write the data to a file. You will need to use the ANSI C stdio library for fopen and fputs, etc..
08-16-2012 03:03 PM
Thanks for the reply! I think your p.s. gets to the heart of my problem - the examples provided don't write the data to file, and that's what I don't know how to do. I'm reasonably new to C/C++, so when you say "...use the stdio library" that makes sense, but I'm still lost at sea as to *how*.
If you've modified the ContAcq-IntClk example to write to file, any chance you could post the relevant code to give me an example to chew on?
Thanks!