From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Continuous Software Timed Analog Output for the USB-6008 and USB-6009

Code and Documents

Attachment

This program demonstrates how to perform continuous analog output tasks on the USB-6008 / 6009 and also incorporates the theory of operation that is associated with software timed analog output. Continuous software timed analog output means that your analog channel will update only once for every iteration of the program's while loop. It is important to remember that these devices allow a maximum update rate of 150 samples per second on each channel; therefore the main program's while loop can iterate no faster than once every 6 ms.

It is also important to remember that these devices allow an output voltage range of 0 to 5 Volts. For demonstration purposes, this program outputs a sine wave with a DC offset of 2.5V and allows the user to select the number of points per cycle. It will be observed that increasing the points per cycle will increase the resolution of the output waveform, but also decreases its frequency. The approximate period of the output waveform is equal to the points per cycle times the output rate.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors