Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I vary the duty cycle of a PWM signal inside a while loop

I´m using the block "Generate Pulse-Train" to generate a PWM signal on two counter´s OUT pin. But with that block I can not make my controller change the duty cycle of the signal value inside a while loop, in order to control the speed of a DC motor. So, how can I vary the duty cycle of a PWM signal inside a while loop??
 
Thanks!!
0 Kudos
Message 1 of 2
(3,162 Views)
Hello Mr. Mafra,

I went to ni.com and searched for 'pwm daqmx' and found the following example as the first hit:
DAQmx : Pulse Train Generation with Changing Pulse Specs (PWM)

Basically the way you do it is by using a property node to change the pulse specs for the PWM.  It's actually pretty simple once you see it.

Enjoy!
0 Kudos
Message 2 of 2
(3,151 Views)