virtual signal generator using the ni

advertisement
Nonconventional Technologies Review
Romania, June, 2013
2013 Romanian Association of Nonconventional Technologies
VIRTUAL SIGNAL GENERATOR USING THE NI-USB 6008 DATA ACQUISITION
DEVICES
Bogdan Mihai
“Lucian Blaga” University of Sibiu, mihai.bogdan@ulbsibiu.ro
ABSTRACT – Educators and researchers worldwide are using National Instruments products to automate routine tasks, accomplish
new objectives, replace outdated and expensive equipment, and demonstrate students the potential of high technology. This paper
present the use of data acquisition (DAQ) device and LabVIEW to implement a signal wave generator and demonstrates how we can
generate a waveform using the NI-USB 6008. The USB 6008 can output single points of data and are not capable of buffered
generation. Hence, we have to output the waveform one sample at a time. Are generated 4 waveforms: Sine, Square, Triangle and
Sawtooth; the array of data is thereafter indexed and then ouput one element at a time.
KEYWORDS: NI USB 6008, LabVIEW, DAQ, NI-DAQmx, Express VI.
1. INTRODUCTION
behind Polymorphic VIs is to use one VI for each
high level function, such as reading, writing,
beginning the acquisition and ending the acquisition,
and then to configure that VI for the specific data
type.
Engineering sciences and education have always
been dynamically interrelated with technology
change. Educators and researchers worldwide are
using National Instruments products to automate
routine tasks, accomplish new objectives, replace
outdated and expensive equipment, and demonstrate
students the potential of high technology [1].
The data acquisition hardware used in this paper is
NI USB-6008 multifunction I/O device, which
interfaces to the PC through a USB connector. It has
8 differential analog voltage inputs, 2 outputs, 12
channels which can be used as either DI or DO
(configured individually), and 12-bit resolution. A
USB device was chose for simplicity, but it is one of
the many different types of data acquisition devices
that can be used. Another common interface is a
PCI-slot data acquisition card. These cards can be
plugged into PCI-slots on the computer’s
motherboard, much like a sound or Ethernet card.
Last years LabVIEW software made a great
expansion in industrial measurement applying and
virtual instrumentation in data acquisition.
LabVIEW is a graphical programming language
which combines data acquisition, analysis, and
presentation tools into one software program. We
can use traditional NI-DAQ and NI-DAQmx to
generate analog signal, each with its own application
programming
interface
(API),
hardware
configuration, and software configuration.
The National Instruments USB-6008 provides basic
data acquisition functionality for applications such
as simple data logging, portable measurements, and
academic lab experiments. The NI USB-6008 are
ideal for students. We are create our measurement
application by programming the NI USB-6008 using
LabVIEW and NI-DAQmx driver software for
Windows [3].
NI-DAQmx is the latest NI-DAQ driver with new
VIs, functions, and development tools for
controlling measurement devices. The advantages of
NI-DAQmx over previous versions of NI-DAQ
include the DAQ Assistant for configuring channels
and measurement tasks for a device; increased
performance, including faster single-point analog
I/O and multithreading; and a simpler API for
creating DAQ applications using fewer functions
and VIs than earlier versions of NI-DAQ. In
situations where execution speed is critical, the
DAQmx VIs are the correct choice for data
acquisition. In previous versions of DAQ there were
different levels of VIs with a range of difficulty for
different levels of users. Now with DAQmx, these
VIs have been combined into “Polymorphic VIs” to
integrate functionality and ease of use. The idea
LabVIEW includes a set of VIs that let you
configure, acquire data from, and send data to DAQ
devices. Often, one device can perform a variety of
functions: analog-to-digital (A/D) conversion,
digital-to-analog (D/A) conversion, digital I/O, and
counter/timer operation [2].
LabVIEW interacts with many kinds of real world
hardware.
5
To see what devices are recognized by the computer,
go to Start » Programs » National Instruments »
Measurement & Automation and then select My
System » Devices and Interfaces.
Physical Channel: A physical channel is a terminal
or pin at which an analog or digital signal is
measured or generated.
Virtual Channel: A virtual channel is a collection
of property settings that can include a channel name,
a physical channel, input terminal connections, the
type of measurement or generation, and scaling
information.
Task: A task in NI-DAQmx is a collection of one or
more virtual channels with timing, triggering, and
other properties.
2.1 Virtual signal generator Front Panel
The front panel window is the user interface for the
VI. Figure 3 shows a front panel window of the VI.
Figure 1. NI-DAQmx Data AcquisitionVIs
Under NI-DAQmx Devices section we see all of the
devices listed, including NI USB-6008.
Figure 3. Virtual instrument Front Panel
The front panel is made with:
•
•
•
•
Figure 2. My System Configuration
one control to select Physical Chanals;
two controls to select the Maximum and the
Minimum Value of the generated signal;
two controls for changing the amplitude and
frequency of the generated signal;
one Enum Control (Select) with 4 positions, for
selecting the type of signal:
2. REALIZATION OF VIRTUAL
INSTRUMENT
0-Sine
DAQmx is the LabVIEW driver that has
significantly simplified the programming of data
acquisition hardware in LabVIEW. The following
are the definitions related to DAQmx [4].
2-Triangle
1-Square
3-Sawtooth
•
•
6
one STOP button;
one graphical indicator to display the generated
signal.
2.2 Virtual signal generator Block Diagram
NI-DAQmx is the next generation drivers for the
data
acquisition
hardware
from
National
Instruments.
Figure 4. Virtual instrument Block Diagram
It is easy to use and has many new features such as
improved ease of use, faster development time,
multithreaded measurements and increased accuracy
of measurements. NI-DAQmx can be used to
generate analog signals if the data acquisition
hardware has the analog output capability.
The DAQmx VIs can be found under Functions >>
All Functions >> NI Measurements >> DAQmx
Data Acquisition.
Figure 5. DAQmx Create Virtual Channel
The following are the steps for creating virtual signal
generator, block diagram.
2. Create the waveform data for the analog signal
generation. I have used Simulate Signal Express VI
to create the waveform. I used 4 Simulate Signal
Express VI inserted in a Case Structure, for selecting
the 4 types of signals (Sine, Square, Triangle and
Sawtooth).
1. Create a virtual channel and task using the NIDAQmx Create Virtual Channel VI. Select Analog
output and than voltage.
- Physical Channels specifies the names of the
physical channels to use to create virtual channels.
The DAQmx physical channel constant lists all
physical channels on devices and modules installed in
the system. You also can wire a string that contains a
list or range of physical channels to this input.
3. Call the Start VI to start the acquisition.
This VI transitions the task to the running state to
begin the measurement or generation.
- Maximum value specifies the maximum value you
expect to generate.
Figure 6. DAQmx Start Task
- Minimum value specifies the minimum value you
expect to generate.
If I do not use this VI, a measurement task starts
automatically when the DAQmx Read VI runs. The
7
autostart input of the DAQmx Write VI determines if
a generation task starts automatically when the
DAQmx Write VI runs.
software is in flexibility concerning requirements that
could be also modify during experiments realisation.
This paper demonstrates how to perform continuous
analog output tasks on the NI USB-6008 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 also important to remember that these devices
allow an output voltage range of 0 to 5 Volts. This VI
outputs a signal wave (sine, square, triangle, and
sawtooth) with a DC offset of 2.5V
4. REFERENCES
1. BogdanM., PanuM., ViorelA., Teaching data
acquisition on a virtual laboratory, the 4thBalkan
Region Conference on Engineering Education,
ISSN 1843-6730, 12-14 Iulie, Sibiu, 2007.
2. Bogdan, M., Measurement experiment, using NI
USB-6008 data acquisition, Journal of Electrical
and Electronics Engineering, Vol.2, Nr.1, 2009,
ISSN 1844-6035, University of Oradea Publisher,
2009.
3. Bogdan, M., Sampling rate and aliasing on a
virtual laboratory, Journal of Electrical and
Electronics Engineering, Vol.2, Nr.2, 2009, ISSN
1844-6035, University of Oradea Publisher, 2009.
4. Bogdan, M., Virtual instrument, for frequency
measurement and spectral analysis, Journal of
Electrical and Electronics Engineering ISSN/
EISSN: 18446035 20672128 Year: 2011 Volume:
4 Issue: 1 Pages: 19-22.
5. National Instruments LabVIEW Graphical Programming Course, 2007.
6. A quick guide to NI USB-6008/6009 I/O device,
available at: http: //techteach.no/ publications/
labview.
7. E. Luther, Electronics Experiments Using USB
Data
Acquisition,
available
at:
http:
//cnx.org/content/col10393/.
8. http://zone.ni.com/devzone/cda/epd/p/id/6405.
9. https://decibel.ni.com/content/docs/DOC-16843.
Figure 7. Simulate Signal Express VI inserted in a Case
Structure
If you do not use the DAQmx Start Task VI and the
DAQmx Stop Task VI when you use the DAQmx
Read VI or the DAQmx Write VI multiple times,
such as in a loop, the task starts and stops repeatedly.
Starting and stopping a task repeatedly reduces the
performance of the application.
4. Write the waveform data in a loop until the user
hits the stop button or an error occurs.
Figure 8. DAQmx Write
This VI write data to one or more channels.
3. CONCLUSIONS
Compared with classical way of experimental
investigation, main advantage of using DAQ with
virtual instrumentation interface by LabVIEW
8
Download