Example Programs

Showing results for 
Search instead for 
Did you mean: 

PWM Servo Control with DAQ


This program will allow you to create a continuous pulse train with a duty cycle that varies in accordance to an acquired input voltage using only DAQ hardware.



In this example, You can supply the input voltage by simply wiring the selected analogue output to the corresponding analogue input and then adjust the Input Voltage dial in order to see the effects, but this "simulated" controlling voltage source can also be disabled if you wish to provide it by other external means.


Steps to implement or execute code

  1. Choose an Analogue Output, two Analogue Inputs and one Counter on your DAQ device for which the program can use. Wire the Analogue Output to the first Analogue Input and the Counter Output to the second.
  2. On the front panel select the chosen Analogue Output on your device within the "Simulated Source (AO)" drop down list, both Analogue Inputs (in the order mentioned above) within the "Analogue Inputs" drop down list and the chosen Counter within the "PWM Counter" drop down list.
  3. Run the program and vary the "Input Voltage" dial on the front panel. You should be able to observe the pulse width varying in accordance to the voltage.

LabVIEW 2012 or compatible
NI-DAQmx 16.0 or compatible

cDAQ with C series Counter Input and Analog I/O or compatible DAQ devices



**This document has been updated to meet the current required format for the NI Code Exchange.**