06-20-2019 01:13 PM
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 Generated
DAQ 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.
06-20-2019 01:39 PM
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