Overview
This VI creates a Pulse Width Modulation (PWM) signal on any number of Digital Output (DO) lines available on the hardware. You may specify the duty cycle and frequency of the PWM. Only one Counter Output (CO) is used as the sample clock for multiple Digital Outputs (DO), rather than using one counter per PWM signal. This example was intended for use with National Instruments' M Series devices.
Setup
- Select the device name of the M Series device.
- Select the correlated Digital I/O lines to use. On an M series, this is port0.
- Expand the array of Duty Cycle Controls so that you have one control for each line you have specified.
- Make a connection to any of the digital lines on the selected port.
Notes
The Frequency value is the frequency of one complete square wave pulse. The sample clock rate is actually 1000 * Frequency, and each complete square wave consists of 1000 points. Hence, the maximum frequency that can be achieved is dependent on the maximum update rate of the hardware, calculated as follows:
MAX Frequency = MAX Digital Rate/1000
You can increase the maximum value of Frequency by editing the VI to create a square wave array of size less than 1000.