National Instruments (NI) offers a wide range of data acquisition (DAQ) solutions to engineer and scientists since its inception. However a small time hobbyist may feel afraid to get one due to their high cost.
NI USB 6008/6009 offers a low cost alternative to hobbyist and college students. Its plug and play ability is convenient and offers less setup time.
In this post I will post the setup and code for generating sinusoidal waveform using analog output channel of USB6008.
Before that I must mention that analog output in USB 6008 is software timed. 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 cannot iterate faster than once every 6 ms.
Secon important thing to keep in mind is that USB 6008 can output analog voltage in the range of 0...5VDC. So the output sinewave is not truly AC but a unipolar sinusoid. The code below will generate a sinusoid around 2.5 VDC offset.
On the front panel, we select the appropriate Physical channel, set the output rate and points per cycle to get the desired frequency of sinewave.
The output sine wave will have an approximate frequency = 1 / (output rate * points per cycle).
No comments:
Post a Comment