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

Measuring continuously counter edge separation

$
0
0

Dear all,

 

I'm trying to measure continuously the separtion between pulses on a pulse train coming from a measurment device.

For that I'm using the source "ctr0" (physical channel PFI8) of my NI pcie 6351 card (X serie). The train amplitude is around 3V with an aproximate frequency of 500Hz.

I wrote a C++ program using the DAQmx library and everything is fine on that front, I don't get any error when calling any DAQ function.

here is the related part of my code :

error = DAQmxCreateTask("", &coTask);
DAQErrChk (error, "coTask DAQmxCreateTask");

error = DAQmxCreateCITwoEdgeSepChan(coTask, "dev1/ctr0", "", 10.0e-8, 1, DAQmx_Val_Seconds,
                                        DAQmx_Val_Rising, DAQmx_Val_Rising, NULL);
    DAQErrChk (error, "coTask DAQmxCreateCITwoEdgeSepChan");

error = DAQmxCfgImplicitTiming (coTask, DAQmx_Val_ContSamps, 1000);
    DAQErrChk (error, "coTask  DAQmxCfgImplicitTiming");

error = DAQmxStartTask(coTask);
        DAQErrChk (error, "coTask DAQmxStartTask");

 error = DAQmxReadCounterScalarF64(coTask,1 ,&data,0);
    qDebug()<<data;

I linked the

DAQmxReadCounterScalarF64

function to a button callback so I can check at reguler interval the last measurement. the problem is : there is no measurement. Each call to the measure function hit the time out.

I also tried to measure the train pulse frequency with no success whatsoever.

I'm starting to think that the amplitude of the pulses is too low (~3V) and the task is expecting a classic 5V TTL but I haven't find any method allowing me to define the amplitude of the pulse.

I tried:

 DAQmxSetDILogicFamily(coTask, "dev1/ctr0", DAQmx_Val_2point5V)

but apparently, this method doesn't apply for counter.

The weird thing is that I can count the number of pulses in the train.

Any help would be welcome!

many Thanks in advance

 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



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