LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

saving counter and voltage signals

I am searching for an alternative to save measured signals with a high sample rate (~10 kHz). For example, I have one Analog input signal and one Quadrature Encoder signal. Until now, I have for both signals an own threadfunction if n samples are aquired. For both signal types i wirte with fprintf an own file and after stopping the measurement, I bring both files together.

 

This method works but I think this is not really the best one. Can you say me what's the better method?

0 Kudos
Message 1 of 4
(3,001 Views)

Hi, chemph

 

if i understand correctly, you want to write both signal to same file , right ?

 

if so, i think you can save the data first in buffer than use function arraytofile  and choose attribute append.

 

ArrayToFile ("", , VAL_DOUBLE, 0, 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_CONST_WIDTH, 10, VAL_ASCII, VAL_TRUNCATE);

 

hope can help!

 

B.R

Gerry

Message 2 of 4
(2,971 Views)

Hi,

 

the problem is now the number of read samples in both tasks is not always the same. In the most time it is but sometimes, there are in one task samples more tahn in the other.

 

    DAQmxCfgSampClkTiming (ni_ai, "OnboardClock", 10000, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 10000);
    DAQmxCfgSampClkTiming (ni_ctr0, "/Dev1/ai/SampleClock", 10000, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 10000);
    
    DAQmxRegisterEveryNSamplesEvent (ni_ai, DAQmx_Val_Acquired_Into_Buffer, AFTERNS, 0, CF_ai, NULL); with AFTERNS=1000
    DAQmxRegisterEveryNSamplesEvent (ni_ctr0, DAQmx_Val_Acquired_Into_Buffer, AFTERNS, 0, CF_ctr0, NULL); with AFTERNS=1000

 

I can imagine, the samples read in buffer until I do DAQmxStopTask(...) are not read after stopping mesuring.I need a solution to stop tasks (in both tasks should now the same amount of samples) that no more samples will me measured but read all data.

0 Kudos
Message 3 of 4
(2,916 Views)

Does anybody has sample code to meas analog voltage and quadrature encoder signal synchron and write in one file?

0 Kudos
Message 4 of 4
(2,723 Views)