LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to decode duty cycle using LabVIEW?

The duty cycles are output of an accelerometer, which are the input of the DAQcard-DIO-24, but how to decode the duty cycles after acquisition? I knew a timer would be useful, but have no idea about how to perform with labview.
 
Thanks a lot.
 
--yang

Message Edited by YangLi on 02-23-2006 05:43 AM

Message Edited by YangLi on 02-23-2006 05:48 AM

0 Kudos
Message 1 of 4
(2,724 Views)
I'm not sure you'll be able to measure any timing parameters reliably. The DIO-24 only has software timed acquisition. What that means is that how often you are able to sample data is strictly dependent on how fast your program runs and with windows, you don't have a whole lot of control over that. If you have LabVIEW 7.1 or greater, then you have the timed loop which has 1msec resolution. What is the range of the frequencies/duty cycles that the accelerometers are puttting out and what kind of resolution do you need? A card with real counter/timers or analog acquisition would work better.
0 Kudos
Message 2 of 4
(2,704 Views)

Thanks Dennis.

I found an express VI called "Timing and Transition Measurements" which would be helpful.

The accelerometer will be used as a tilt sensor, and a 1msec resolution should be OK.

0 Kudos
Message 3 of 4
(2,692 Views)

This will still be a very difficult task without dedicated hardware, and the 1ms resolution will still be relative to other things outside your control. Timed Loops give the tasks they execute a high priority in terms of processor time, but Windows will always be able to preempt LabVIEW in favor of anything it pleases (anti-virus software, automatic updates, screen redraws, etc.). The Timed Loop gives you the ability to dynamically handle what you do in such a situation (discard loop iterations, abort, etc.), but this is not ideal.

You would really be much better off, as Dennis said, with dedicated hardware. Most NI MIO or DIO boards come with a couple counters, which can measure high times and low times against a high-accuracy clock and calculate the duty cycle. The advantage here is that the hardware is doing all the work with real-time accuracy, so you don't have to worry about software-timing and Windows instability. In addition, the API for this in LabVIEW is much simpler.

If you choose to try using timed loops, then you will have pair each digital acquistion with a timestamp and for a sort of digital waveform.

Jarrod S.
National Instruments
0 Kudos
Message 4 of 4
(2,663 Views)