From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Unstable Digital PWM Output to DAQ

I am using the attached VI in attempt to output a variable/controllable digital PWM wave from a NI USB-6356,6366 DAQ. However, my oscilloscope reading is quite unstable compared to using the DAQ Assistant's test output. As seen below to the left, the code generated square wave's duty cycle seems to be oscillating rapidly. It is set to 100 Hz and 50% duty cycle on the front panel. To the right is the stable signal from the DAQ Assistant.

 

Labview Code GeneratedLabview Code GeneratedDAQ Assistant GeneratedDAQ Assistant Generated

The bulk of the code was taken from: https://forums.ni.com/t5/Example-Programs/Software-Timed-Pulse-Width-Modulation/ta-p/3507768

 

Please advise. Thank you.

 

 

0 Kudos
Message 1 of 2
(1,842 Views)

Yup.

 

You picked an example that uses *software* timing.  It is well-known to be orders of magnitude more variable than hardware timing.

 

Use either MAX or a LabVIEW shipping example for counter output and you'll get highly consistent hardware timing.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 2
(1,827 Views)