How to Create a PWM Output Using the DAQ Assistant

Updated Nov 4, 2020

Environment

Hardware

  • C Series Digital Output Device

  • I'm not familiar with the DAQmx palette functions, and I would like to generate a PWM pulse output from my DAQ card using the DAQ Assistant. 
  • How do I output a PWM digital signal in my DAQ device using the DAQ Assistant? 
  • How do I generate a PWM output on my device's digital line? 

The DAQ Assistant doesn't provide a built-in functionality to output a PWM signal on a DAQ device. As a result, additional functions must be integrated along with the assistant in a VI to provide this functionality. The VI could be configured as follows: 



The example code shown above combines three main functions:
  1. DAQ Assistant vi
  2. Simulate Signal vi
  3. DWDT Analog to Digital vi
The logic behind the program goes as follows: 
  1. A square analog waveform is generated using the Signal Simulator Express VI
  2. An analog to digital conversion with 1bit resolution is performed using the Analog to Digital VI
  3. A 1D array of a Digital Waveform is created and inputted to the DAQ Assistant. 
The DAQ Assistant is internally configured as follows: 
  • Digital Output
  • Continuous Samples
  • Samples to Write = 100
  • Rate = 1kHz


The example code's functionality is shown on the image below:



Additional Information

The solution provided below is not exhaustive, and additional time-based options could also be explored.