This is only a preview of the February 1994 issue of Silicon Chip. You can view 30 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Build A 90-Second Message Recorder":
Items relevant to "Compact & Efficient 12-240VAC 200W Inverter":
Articles in this series:
Items relevant to "A Single Chip Audio Amplifier":
Articles in this series:
Items relevant to "Build A Novel LED Torch":
Items relevant to "40V 3A Variable Power Supply; Pt.2":
Items relevant to "Computer Bits":
|
Instrumentation
programming – doing
it the graphical way
In the past, PCs have been used to control data
acquisition and test equipment via programs
written in the conventional way, with hundreds
or thousands of lines of text based code. This
article discusses LabVIEW – software based on
graphical programming.
By JACK BARBER
The introduction in 1986 of Lab
VIEW (Laboratory Virtual Instrument
Engineering Workbench) for the
Macintosh revolution
ised PC-based
instrumentation with the concept of
graphical programming – developing
block diagrams rather than writing
conventional, text-based code. Lab
VIEW was the first graphical program-
ming language used to integrate several popular classes of instrumentation
hardware for test and measurement
applications.
In 1992, National Instruments
announced LabVIEW version 2.5 for
Sun SPARCstations while version 3.0,
introduced in 1993, made graphical instrumentation applications complete
ly portable between Macintoshes,
Windows PCs or Sun SPARCstations.
This article explains the benefits of
graphical programming with LabVIEW
and the characteristics and features
of LabVIEW that differentiate it from
other products that appear to have a
similar look and feel.
Graphical programming
Graphical programming offers the
ability to create software applications
to those who otherwise do not have the
time or skills to program using conventional text languages. Graphical
programming lets the user draw a diagram or a picture to explain a process
or algorithm. A user can easily scan
a picture of a graphical program for
relevant features, data flow structure
and complex relationships that would
otherwise be hidden in the code of a
text-based program.
Graphical programming can be tailored for a particular application area.
By supplying the user with familiar
tools and terminology, the software
package serves as an enhancement
rather than a hindrance to the application. A LabVIEW program or
subprogram is like an instrument with
front-panel controls. The “instrument”
measures inputs and displays outputs.
This instrument also has internal circuits. G, the “language” in LabVIEW,
gives users the ability to draw the
schematic, so to speak, for these circuits. These software emulations of
hardware instruments are therefore
called “virtual instruments,” or VIs.
Graphics vs icons
Fig.1: system developers use pull-down and pop-up menus to equip the front
panel with indicators and controls. The front panel serves as the graphical user
interface during program execution.
22 Silicon Chip
Today, several software products
use icons for visual representations
however few of these are true graph-
ical programming systems. Most are
menu-driven systems where each icon
represents a function and contains a
list of options. Users connect these
icons to specify an action. Icon-based
systems are typical
ly limited by a
small set of functions, options and
ways in which users can connect the
icons. However, such programs may
well satisfy users who have simple
application requirements that will not
become more demanding in the future.
With Lab VIEW ’s graphical programming approach, the novice can
quickly assemble simple programs
such as those typically created with
menu-driven packages. However,
more experienced users will find
LabVIEW also offers a good alternative
to conventional text-based languages
such as BASIC or C. Like convention
al programming systems, LabVIEW
incorporates features such as hierarchy, execution control, programming
structures and also a compiler.
Virtual instrument
Before selecting software, it is
important to consider how you want
your system to present data. Due to
limited space on the screen, combining
the GUI elements with the functional
elements in a diagram (as some software products do) is impractical for
complex applications.
A LabVIEW VI has separate panels
and a diagram optimised for operating
and programming, respectively. On
the front panel, users arrange the controls and indicators in a logical order,
add background pictures and create
custom controls to add context to the
GUI (Graphical User Interface). In the
diagram, small graphical equivalents
of the GUI elements save space and
make it easier to construct a block
diagram.
Fig.2: Temperature System VI has a While Loop that contains a For Loop
(which acquires a group of temperature readings) and a Case Structure (which
determines if the data is to be analysed.)
You can click a switch, move a slider, tweak a knob, or type a value on the
front panel to interactively control the
system during execution. Meanwhile,
the indicators provide feedback and
results. LabVIEW can store the data by
printing the front panel or by saving it
as a picture file.
LabVIEW’s block diagram defines
what the virtual instrument (VI) does.
The block diagram contains terminals
(smaller representations of the front
panel controls and indicators) that
pass data to and from the front panel.
You connect these terminals using
the wiring tool to pass data from one
block to the next. The diagram may
have multiple data paths and thereby
simultaneous operations.
The LabVIEW system also has
functional blocks to perform simple arithmetic functions, advanced
Creating the front panel
In LabVIEW, you first create the front
panel to define the input and output
parameters of the program. LabVIEW
has controls and indicators (knobs,
sliders, switches, LEDs, text boxes,
charts and graphs) in hierarchical
menus. Once an indicator or control is
selected and placed on the panel, it can
be moved, sized, labelled and configured in terms of data type, dimension,
range, default and mechanical action.
The user can import pic
tures and
controls to tailor a panel to a specific
application.
Fig.3: LabVIEW is a graphical programming system for developing data
acquisition & instrument control applications on Macintosh computers,
Windows PCs & Sun SPARCstations.
February 1994 23
distribute VIs to users who can load
and run VIs but cannot edit them or
display their diagrams. This protects
the propriety rights and integrity of
VIs. The LabVIEW Run-Time System
can serve as a low-cost test station
or as an efficient way to package and
resell VIs.
Input/output (I/O)
Most applications require the use of
hardware for data collection, so users
should also consider what types of I/O
their application will require –plug-in
data acquisition and/or in
strument
control. The software should work
with a variety of hardware – it is then
easy to integrate different types of
hardware into one system. The data
acquisition (DAQ) hardware should
have ready-to-use instrument drivers
available and it should be easy to add
new drivers.
LabVIEW has drivers for more than
300 GPIB, VXI and RS-232 instruments. The drivers consist of high-level functions with a front panel to operate each instrument. More importantly,
each icon can be incorporated into a
block diagram with other driver icons
to build a complete test system.
Data analysis
Fig.4: Lubrizol Corporation in Wickliffe, Ohio (USA) uses a Macintosh
Computer running LabVIEW in its high temperature fluid durability cycling
tests. Lubrizol uses LabVIEW to create unique screens to easily acquire,
analyse and save raw data from the tests. This process has eliminated many
of the variables involved in the analysis of the data & streamlined the report
generation process.
acquisition and analysis routines
and file I/O and network operations
that store or retrieve data in ASCII,
binary or spreadsheet formats. LabVIEW also contains a formula node
for typing in simple arithmetic
equa
t ions. For more complicated
routines, the Code Interface Node
(CIN) links external code to the diagram. This feature is important for
users that have already developed
routines, like analysis algorithms,
in a conventional language.
LabVIEW includes extensive tools to
develop, test and debug a VI system.
The Help window describes each VI
and its connec
tions. The program
immediately indicates incorrect wire
connec
tions with a dashed line. In
addition, the Error window lists syntax
errors. Execution highlighting traces
the data paths during VI execution.
The single-step mode and breakpoints
24 Silicon Chip
also aid in VI debugging.
LabVIEW has programming structures such as for loops, while loops
and case statements for sequential,
repetitive and branching operations
that determine if or how many times
a set of functions will be executed.
Graphical compiler
LabVIEW is the only software of its
type that features a graphical compiler – a system that compiles its block
diagrams into machine code. This produces programs that execute at speeds
comparable to compiled C programs.
Consequently, LabVIEW programs execute 10 to 1000 times faster than those
of any other graphical instrumentation
programming system.
The graphical compiler also creates
VIs for the LabVIEW Run-Time System.
With this compact, low-cost version
of LabVIEW, system developers can
Users need to convert acquired data
into meaningful results. The Analysis
VI libraries offer digital signal processing (DSP), digital filtering, statistics
and numerical analysis functions.
Also included are functions for array
manipulation, complex arithmetic
and statistical functions, Fast Fourier
Trans
form (FFT) and Fast Hartley
Transform (FHT) integration, differ
entiation, convolution and correlation,
power spectrum and pulse parameters;
finite impulse response and infinite
impulse response digital filters; win
dowing functions; signal generation;
linear, exponential and polynomial
curve fitting; advanced statistics; and
complex and matrix operations.
As you can see, LabVIEW is a comprehensive solution to virtual instrument programming. It is intuitive and
the resultant compiled programs run
very fast.
For further information on instrumentation programming and other
data acquisition products, contact
Tony O’Donnell, National Instruments
Australia Corporation, PO Box 466,
Ringwood, Vic 3134. Phone (03) 879
SC
9422 or fax (03) 879 9179.
|