Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Control PWM idle state

I need to be able to turn off and on the pwm with 1ms intervals, is this possible?

Presently, I can control the wdiths of the pulses at that resolution, but I cannot turn the pwm off.  How do you do this?
0 Kudos
Message 1 of 3
(3,666 Views)
It'll help to know what board you have and more details about the app.

The simp-lest approach is software-timed.  Stop the task (but don't Clear it) to turn PWM off.  Start it again to turn it back on.  This method allows you to vary the timing between on and off cycles.  However, you won't be able to get absolutely reliable 1 msec intervals without a real-time OS. 

Another approach is to configure your PWM generator to be "pause-triggered" by another counter.  Your PWM generator will then produce output only when the other counter's output is, say, high.  This method allows you to produce precise and repeating on-off cycles.


-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 3
(3,661 Views)
Hi Kevin -

Thanks for the expanation and tips.  I'd like to elaborate a little bit to help TEster out:
  • A software-timed task (one that turns the pulses on and off using commands in the program) will be very slow, event with the LabVIEW Real-Time OS.  The Windows OS has a jitter of about 10 ms.  This means that if you want to turn a pulse on, then off every 1 ms, it could take up to 11 ms to perform.  LVRT is deterministic, so it executes a timed loop in exactly the same amount of time, every time.  But it isn't necessarily faster than Windows.  This Developer Zone article discusses LVRT benchmarks in detail: Benchmarking Single-Point Performance on National Instruments Real-Time Hardware
  • As you said, a DAQ or counter/timer device has onboard counters that can be paired to generate a hardware-timed PWM signal.  This is a MUCH faster output with deterministic timing, since it's driven entirely in hardware.  A simple modification to a DAQmx shipping example yields the result (attached).

David Staab, CLA
Staff Systems Engineer
National Instruments
0 Kudos
Message 3 of 3
(3,651 Views)