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

Trouble measuring duty cycle of signal

$
0
0

Dear community,

 

I am having trouble measuring the duty cycle of a TTL signal. I generate analog signals through aoX (about 10 Hz signal) and feed them to an electronics module. The module converts these signals into pulse signals and I would like to measure the duty cycles within the analog output duration (20 seconds). However, within the timeout period no pulses are captured which results in an error message.

I use a python-C wrapper so I am looking for a working example in C.

The TTL signal is connected to ctr0 gate. I am not sure which timeclock is used but since I do not set it, I guess the default clock of 20 Mhz is used. Do I need to route the clock to ctr0 source? The main lines of code are:

 

counter1 = Task()
counter_channel="Dev1/ctr0"
counter1.CreateCIPulseChanFreq (counter_channel,"", 1, 200, DAQmx_Val_Hz);

[...]

analog_output.WriteAnalogF64(samplesPerChan,1,0,DAQmx_Val_GroupByChannel,data_out,byref(sampsPerChanWritten),None)

counter1.ReadCtrFreq(samplesPerChanCtr,timeout,DAQmx_Val_GroupByChannel,duty_freqA, duty_cycleA, buffer_size_counter,byref(read),None)

[...]

 

I would really appreciate any help.

 


Viewing all articles
Browse latest Browse all 1271

Trending Articles



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