Start
Hardware
Overview
Embedded Code
User Interface
Functional Code
System Development
Sources and PDF
USER
INTERFACE
I
developed the user interface with National Instruments’s
LabVIEW (see Photo 2). LabVIEW is a graphical
programming language meant for engineers to easily
acquire and display data. Unlike a text-based
language, code is created using graphical virtual
instruments (VIs), which are the equivalent of
functions. You can create a function and then
save it as an icon. Then multiple functions can
be used by a larger function, again represented
as an icon. Hieratical code is easy to build,
and it’s easy to reuse functions.
|

(Click
here to enlarge)
|
Photo
2—Take a look at the ARM Scope’s GUI. The
virtual oscilloscope displays the incoming
analog data and enables point-and-click control
over the operation of the processor. |
LabVIEW
is a data flow language, which means the flow
of data has full control over the order of events.
Each of the inputs and outputs of a VI are represented
as terminals on the icon. To pass data from VI
to VI, you must draw wires from the output terminal
of one to the input terminal of another. Built-in
functions are found on a graphical palette rather
than within .h files. Functions are logically
grouped and are as easy as drag and drop. Code
can be executed immediately. If there is something
that will prevent it from running, the environment
is very clear as to where the problem lies.
The
view used to create the program code is called
the block diagram. The view used to create the
user interface is called the front panel. To create
the user interface, all of the controls, indicators,
and graphs are also logically grouped in their
own palette so you can drag and drop them. When
you drop a control on the user interface, it gets
a representative icon on the block diagram as
a source of data. When you drop an indicator on
the user interface, it gets a representative icon
on the block diagram as a sink for data.
In
the block diagram, data is represented by wires
similar to those you’d see in a schematic capture
package (see Photo 3). Arrays of data appear as
thicker wires. As dimensions are added to the
array, the wires appear even thicker. Also, like
in the C language where structures are used to
create custom data types that contain multiple
types of data, LabVIEW uses something called a
cluster. For loops and while loops are just drawn
around the code that you want to iterate on. Local
data is sent around the loop via shift registers.
LabVIEW handles alternate code execution by way
of case structures. For every anticipated case
(and a default), you draw code within the structure.
Debugging is also very easy. LabVIEW lets you
watch data flow through the wires in slow motion.
You can also set break points and create probes
(watch windows).
|

(Click
here to enlarge)
|
Photo
3—This is where all the graphical code is
developed. Note that there are two main sections
of code that run in separate threads. |
The
other thing that LabVIEW is famous for is its
connectivity to hardware and other applications.
National Instruments sells hardware such as data
acquisition devices with prebuilt VIs to access
the functionality with little or no programming.
Many equipment vendors such as Agilent provide
LabVIEW drivers for their products. LabVIEW can also handle ActiveX and .NET code, Internet protocols,
and much more with ease.
The
hardware that interested me was my RS-232 serial
port. I needed only four functions to handle the
serial port in Windows XP: Open, Read, Write,
and Close. It just doesn’t get any easier than
that. LabVIEW also produces a multithreaded application
by simply drawing separate sections of code on
the same block diagram. It can also handle some
event-driven programming that responds to button
clicks on the front panel.
The
user interface was created to look like an oscilloscope
screen. The drag-and-drop graph is set up to display
500 points at a time. Clicking in a display list
sets the timebase for the oscilloscope. The analog
inputs and outputs are enabled or disabled by
clicking on appropriately labeled buttons. The
amplitude of the analog output is set by a slider
control, while the shape of the wave is selected
from a dropdown box. The PWM output is set by
clicking in a list that displays all of the available
times bases on my analog oscilloscope.