Quantcast
Channel: Counter/Timer topics
Viewing all articles
Browse latest Browse all 1271

measuring counter periodicaly

$
0
0

Dear all,

 

So I have a counting edges task :

DAQmxCreateCICountEdgesChan(aoTask, "Dev1/ctr1", "", DAQmx_Val_Rising, 0, DAQmx_Val_CountUp);

wich I can interogate by the click of a button :

DAQmxReadCounterScalarU32(aoTask,1 ,&count,0);

now I would like to interogate this counter periodicaly  using an external clock and store the results in a buffer.

DAQmxCfgSampClkTiming(aoTask,"/Dev1/PFI15", samplesPerSeconds, DAQmx_Val_Rising, DAQmx_Val_ContSamps, bufferSize);

up until that point, I followed blindly the "Cnt-Buf-Cont-ExtClk" example. but it doesn't work : every time I try to read the buffer

DAQmxReadCounterU32(aoTask, bufferSize, 1.0, counterData, bufferSize, &read, NULL)

I get the following error message :

Some or all of the samples requested have not yet been acquired.

To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger, make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.

Property: DAQmx_Read_RelativeTo

Requested Value: DAQmx_Val_CurrReadPos

Property: DAQmx_Read_Offset

Requested Value: 0

Task Name: _unnamedTask<1>

Status Code: -200284

 

even if I wait enough to be sure that the buffer is full...

 

so I tried to trigger the reading with a "every N Sample event"

 

DAQmxRegisterEveryNSamplesEvent(aoTask, DAQmx_Val_Acquired_Into_Buffer, bufferSize, 0, EveryNCallback, this);

but the function is never called.

I don't know what I doing wrong here, is my external clock badly configure (wrong source) or something else???

 

I'm using a PCIe-6351 and I code in CPP using DAQ-mx

 

Thanks in advance for your answer

 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>