Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting acquisition start time ( t0 ) from device

I've looked extensively through the documentation and I cannot find how to read t0 via NI-DAQmx C api.  I must be blind I'm pretty sure it's in there somewhere - it's mentioned in the Labview forum.

Thanks,
Chuck
0 Kudos
Message 1 of 5
(7,117 Views)

Hi Chuck,

Can I ask what read function you are using to obtain your data from the DAQ card? Are you working from an example program?

Regards,

Mallori M.

Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training
0 Kudos
Message 2 of 5
(7,091 Views)
I am looking at using DAQmxReadAnalogF64, though I am open to doing something else.  I could do on my own, what is implied by the NI docs - mark the time of the first read and back calculate the beginning of the task by the number of available samples and the sample period.  I was hoping that it was already there for me.  It seems the back calculation is part of LabView, but not the C library.  That makes some sense - in C I can get a callback on the DAQmx thread pretty quickly and be able to mark the times myself.  I suspect that is not possible in LabView hence the library provides the timestamp in LabView.

More likely I will mark the time of sending the start command.  That is what I am doing with our other hardware and I think using a consistent method will keep the times reasonable close. (of course I will commit the task before marking the time)

I've looked in the examples, such as ContAcq-IntClk.c and I do not see any time stamp calls.

Chuck
0 Kudos
Message 3 of 5
(7,089 Views)
Also, is this the correct forum for the C API questions?  I've seen a number of them in the hardware forum "Multifunction DAQ".
0 Kudos
Message 4 of 5
(7,086 Views)

Hi CVilla,

So, after doing some research, I believe you are on the right track in your observation that you could take the time stamp on your own. While in LabVIEW the DAQmx API allows you to acquire data in a waveform datatype that includes t0 and delta t values already, in textbased languages, I do not believe that there is not a waveform data type where this info is managed for you. Instead, an array of numbers is returned indexed by sample number.

The best way to go about getting that t0 value is going to be to commit the task, take a timestamp reading, and then start the task. Then you can use your sampling rate to determine your delta t value, and calculate each sample's timestamp from there.

Some examples functions for the timestamp are the TimeStr, which returns time in the string HH:MM:SS, or the GetSystemTime function, which returns time in 3 integer outputs- one for hours, one for minutes, and one for seconds.

With regards to the proper forum, I think this question might have been better suited to the Multifuction DAQ forum since this was a driver question, but this was fine.

Regards, Mallori M.

Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training
0 Kudos
Message 5 of 5
(7,057 Views)