Example Code

Continuous Analog Signal Generation with USB-6008/USB-6009

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

Creating a software timed continuous analog output signal with the USB-6008/6009.

Description

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.

Steps to Implement or Execute Code

1. Open the ContinuousAnalogOutUSB60086009 VI

2. Configure front panel controls

  • Physical Channel
  • Maximum Value
  • Minimum Value
  • Output Rate
  • Points per Cycle

3. Run the VI

Requirements to Run

Software

LabVIEW 7.1 or later

DAQmx 7.1 or later*

*Driver version must be compatible to your version of LabVIEW

Hardware

USB-6008 or USB-6009

Additional Images

Block diagram

block diagram.PNG


Regards,
Dan King

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

Comments
WSOCT
Member
Member
on

I tried loading your program, but it can't find any of the dll's. Where do I get them?

missing_dll.jpg

Tommy_G
Member
Member
on

Hi WSOCT,

You will need the DAQmx driver to be able to see/use these VIs you see as question marks.

You can download the DAQmx driver from our website at www.ni.com/drivers.

Tommy G.
Product Manager - Search
funhistory
Member
Member
on

I just ran an experiment where I set up a 5V, 0V, 5V, 0V ... pattern using a USB-6008.  Whether I used an analog output or digital output, it generated approximately a 1 kHz pattern on my scope.  How is that possible if it only updates at 150 samples/second?

gogden235
Member
Member
on

I tried to run this program using a 6008.  it did not run.  the error was

   no transfer is in progress becuase the transfer was aborted by client.  the operation could not be completed as specified.  unnamed task ,0.

Angel69
Member
Member
on

Example2VI.png

(Ignore that there is an empty output in the blunde). I want to generate through NI USB-6009 a 60Hz sine wave. I play with the parameters "Frequency" and the constant in the wait VI. I am using a multimmeter to measurer the AC Voltaje and the frequency at the Analog output of the NI USB-6009, but the frequency is not constant and it varies from 30Hz to 44Hz very fast or from 55Hz to 90Hz. What do you recommend me to obtain a constant frequency in the NI-USB 6009 analog output?

kimcheese
Member
Member
on

Hello. I am trying to create output for 2 channels ( x and y). How can I modify the program to make it possible to have 2 sine waves for 2 channels?

Contributors