LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx - Measuring edge position (time) with a counter ?

Hi all, I have two signals that I need to study using a USB 6212 (BNC) card: (1) a short 0-8V signal (~500 ns) (yellow on the plot) (2) a long signal (~6 µs) for which I have to measure the amplitude (purple on the plot). The long signal (2) has to be connected to an analog input so that I can measure its amplitude. In addition, given the duration of the pulses, I need to use the max speed for the ADC conversion. That's why I'd like to use a counter for the other signal and not a second AI (it wouldn't work anyway given the short duration of the pulse (1)). Initially, I wanted to measure the amplitude of (2) only if the short pulse (1) occured, which is possible with a trigger on the AI channel, but in this case I get a too long deadtime and the acquisition is very slow. To speed up the process, I wanted to record all the data with the AI and the times at which the signal (1) gives a rising edge to post-process everything later (using a FIFO I guess). So my question is wether it is possible to measure the position (ie the time) of an edge of a signal with a counter ? The signals measured with a scope are shown on this picture: http://lpnhess.in2p3.fr/~bolmont/NI/outhg1.png Thanks a lot for your help ! Cheers, JB
____________________
JB
0 Kudos
Message 1 of 3
(2,234 Views)

Greetings,

 

Please see 8-3 of http://www.ni.com/pdf/manuals/371931f.pdf

 

This shows that you can use the counter to record the current value stored in the counter that is being driven by a clock. This has the upshot of creating an array that has the times of the event. To do this, you need to set the source and gate properly. These can be set first by configuring the counter to Count Edges (see DAQmx Create Channel) and then updating the CI.CountEdges.Term (in the DAQmx Channel Properties) to the channel that has your signal and SampClk.Src (in the DAQmx Timing Properties) to a known clock, such as the onboard SampleClock.

 

Keep in mind, the specs for the digital ports (which I assume include the counter ports) have a maximum voltage rating of 5.25 volts, so while it probably won't make a difference, you might want to divide down the voltage to be within spec.

 

Of course, there are other ways to do this. For instance, you could just sample a digital port along with your analog port and then in post processing look for edges, but I feel like this is the cleanest way to do it.

 

In any event, it seems very possible.

0 Kudos
Message 2 of 3
(2,218 Views)

Thanks a lot for your answer, I'm going to investigate this.

Cheers,

JB

____________________
JB
0 Kudos
Message 3 of 3
(2,210 Views)