Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I save timestamps for each sample?

Hi 

 

I use the module of NI-9234 to measure the signal of accelerometer. I am using the code that "ContAccelSamp_IntClk_AnlgStart" for daq sample code. Now,i want to data add the timestamps for each sample. How do i use the function or example to solve problem?

 

Nan

0 Kudos
Message 1 of 5
(3,289 Views)

Hi Nan,

 

You may record the timestamp before plotting your data.

Say you are modifying the C# example codes, you can simply add another line of code to record the timestamp right after/before the:

        data = analogInReader.EndReadWaveform(ar);

 same function in VB code can be found at:

        dataToDataTable(data, dataTable)
0 Kudos
Message 2 of 5
(3,274 Views)

Hi wellyhuang

 

Thank your reply!!

 

I have another a question.How do i change arbitrarily the sample/channel ?

I used the example code:ContAcqAccelSamp_IntClk_AnalogStart.2010

 

Jan

Message 3 of 5
(3,228 Views)

Hi Jan,

 

You may try to find the function which is in "DAQmx Configure Code" part in the main function: DAQmxCreateAIAccelChan

Maybe by adding a prompt for inputting the channel name, then pass the parameter to the function (e.g., scanf or getchar, etc.)

 

 

DAQmxErrChk (DAQmxCreateAIAccelChan(taskHandle,"Dev1/ai0","",DAQmx_Val_PseudoDiff,-100.0,100.0,DAQmx_Val_AccelUnit_g,50,DAQmx_Val_mVoltsPerG,DAQmx_Val_Internal,0.004,NULL));

 

 

Welly

0 Kudos
Message 4 of 5
(3,189 Views)

Hi Jan,

 

Does that meet your requirement?

BTW, since it's a follow-up question, maybe you could create another discussing thread to address this question; thus, if that works for you, you may close this discussion; and if it's not, you may go ahead and create another discussion for this.

 

Thanks,

Welly

0 Kudos
Message 5 of 5
(3,162 Views)