Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How to time an output from an input

Hello,

 

I am using Labview with the SCB-68 interface box. At the moment I have an infrared transmitter and receiver coupled with an electric door chime that uses radio waves. My goal is to use the SCB-68 to trigger the door chime button, which in turns activates the actual door chime triggering the infrared transmitter, to have the Infrared receiver pick up the transmitter and send a high signal back to the SCB-68. In other words I want to time how long the whole process takes from start to finish.

 

I have sent up the SCB-68 using the DAQx assistant to send the appropriate inputs and outputs. This all works fine. I wish to know the best method for timing how long the whole process takes. Can someone either help me or point me in the right direction.

 

Thanks

 

K

0 Kudos
Message 1 of 4
(4,023 Views)
Hi Kamilan,

One very accurate way to time a process is with a counter. Counters can use the fastest on-board timebase to measure the time between two digital events. For an M Series card, that timebase is 80 MHz which means you can measure time in increments of 12.5 nanoseconds. If the process is faster than that, then you'll need to use faster hardware.

The overall idea for this approach is to measure the time between the start and stop of your process. Counters can only measure digital (TTL) signals, so you will need to use the digital signals associated with your tasks. For example, you could say that the start signal is the analog output start trigger (ao/StartTrigger) and, assuming you're triggering your analog input to start when it detects the high signal, you could say that stop signal is the analog input start trigger (ai/StartTrigger).

So when you run your VI, the analog output will start and do two things simultaneously: generate the ao/StartTrigger signal and generate the analog output for your door chime. Then, the external equipment goes through its steps and finally a high signal comes to your analog input. If you configured a start trigger to detect that change, then when the high signal comes in, the analog input will do two things simultaneously: generate the ai/StartTrigger and measure the incoming signal.

If you use a counter to measure the time between these two digital edges, then you'll have the measurement you want. DAQmx installs an exampled called "Meas Two Edge Separation.vi" that will give you the framework you need.
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 2 of 4
(4,012 Views)

Hey there,

Ok, I'll give it ago and look at the edge example. Will this work with two DAQx. One analogue and one digital???

 

Cheers

 

K

0 Kudos
Message 3 of 4
(3,976 Views)
Hi Kamilan,

As I said before, counters can only measure TTL signals. If you try to measure another kind of signal, then the counters may ignore or mis-detect any 'edges' in that signal. The way to measure analog loop time is by measuring the time between the start triggers (which are TTL signals generated by the boar) for your analog tasks.

If you're trying to measure when a digital task starts or stops, then a counter won't support that -- while some M Series boards have hardware-timed digital IO, they depend on an external clock to drive them. You can use any clock signal you like, but digital tasks on M Series boards cannot use start triggers, so you won't have a signal that corresponds to a digital task starting.

One way to work-around this is to use a counter to provide the digital task's sample clock. A counter generation task supports a start trigger, and you can use use that signal to make your measurements.
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 4 of 4
(3,964 Views)