You are on page 1of 23

Digital Electronics and Computer

Interfacing
PH 534
Tim Mewes

Spring 2011

Digital Electronics
Binary systems with two possible values (logic states):
High/Low
ON/OFF
1/0
TRUE/FALSE
First part of the course, after introduction to LabVIEW

01/11/2007

Digital Electronics and Computer Interfacing

Computer interfacing
Connects the digital world to the analog world
One way to communicate with Laboratory equipment is
by using GPIB-commands
(General Purpose Instrumentation Bus)
Data acquisition cards (DAQ-cards) provide another
interface between the computer and the outside world

Second part of the course

01/11/2007

Digital Electronics and Computer Interfacing

1. LabVIEW Basics
1.1 Front panel
1.2 Block diagram
1.3 Getting help
1.4 Debugging
Experiment #1

01/11/2007

Digital Electronics and Computer Interfacing

1. LabVIEW Basics

Block diagram:
contains the graphical
program code
Front panel:
the interface to the
program

<CTRL>-E switches
between Block diagram
and Front panel
Together these two parts constitute a Virtual Instrument short: VI
A VI is typically build by using other VIs which are then called subVIs
01/11/2007

Digital Electronics and Computer Interfacing

1. LabVIEW basics

1.1 Front panel

Pull-down menus
Window title
VI icon (right click
for short cut menu)
Toolbar

Area that holds


controls/indicators
enables user interaction

(Numeric) controls:
Enable the user to enter data
01/11/2007

(Numeric) indicator:
Displays data

Digital Electronics and Computer Interfacing

1. LabVIEW basics

1.1.1 Front panel toolbar


run continuously button

resize objects
pause/resume button
align objects

text settings
run button

show/hide
context help

distribute objects

abort execution button

reorder objects

broken run button


indicates coding errors
indicates running top level VI
indicates that a VI caller is running

01/11/2007

Digital Electronics and Computer Interfacing

1. LabVIEW basics

1.1.2 Controls palette


right clicking in an empty area of the front
panel opens the controls palette
choose the general type of control/indicator:

1. Numeric controls & indicators


2. Boolean controls & indicators
1

2
5

01/11/2007

3. String & Path controls & indicators


4. Array, Matrix & Cluster controls & indicators
5. Graphs (indicators)

Digital Electronics and Computer Interfacing

1. LabVIEW basics

1.1.2 Controls palette


right clicking in an empty area of the front
panel opens the controls palette
choose the general type of control/indicator:
1. Numeric controls & indicators
from the submenu choose the desired control/indicator
1

place the object on the front panel:

5
left click

type in a name for the control, finish with


or by clicking on an empty spot of the front panel
avoid using generic names like Numeric!
01/11/2007

Digital Electronics and Computer Interfacing

1. LabVIEW basics

1.1.3 Short cut menus


right clicking in different areas of a control opens
different short cut menus

changes a control into an indicator and vice versa


opens the properties dialog box

Can be used to change the default value, data range, label,


documentation and many more properties of objects.
01/11/2007

Digital Electronics and Computer Interfacing

10

1. LabVIEW basics

1.1.4 VI icon and connector pane


right click on the icon opens the short cut menu
opens the icon editor:

always design your own icon for your VIs


avoid using the standard icons!
many times you will only see the icon of
your VIs
shows the connector pane of the VI
the connector pane is used to define
inputs and outputs of subVIs
(will be discussed in detail later)
01/11/2007

Digital Electronics and Computer Interfacing

11

1. LabVIEW basics

1.1.5 Icon editor


Pencil: Draws and erases pixel by pixel.

Copy from: Copies from a color icon to a black and white


icon and from a black and white icon to a color icon.
Line: Draws straight lines.

Color Copy: Copies the foreground


color from an element in the icon.
Fill: Fills an outlined area with the
foreground color.
Rectangle: Draws a rectangular
border in the foreground color.
Filled Rectangle: Draws a rectangle
with a foreground color frame and
filled with the background color.
Select: Selects an area of the icon to
cut, copy, move, or make other
changes.

Text: Enters text into the icon. Double-click this tool to


select a different font. While text is active, you can move
the text by pressing the arrow keys.

Foreground/Background: Displays the current foreground and


background colors. Click each rectangle to access a color picker from
which you can select new colors.

01/11/2007

Digital Electronics and Computer Interfacing

12

1. LabVIEW basics

1.1.6 Tools palette


<SHIFT> + right-click or select it in the View pull-down menu
Used to modify the cursor appearance and its functionality

Automatic Selection Tool (off): Keep it on!


<SHIFT>+<TAB> turns it back on
Operating Tool

Scrolling Tool

Positioning/Resizing Tool

Breakpoint Tool

Labeling Tool

Probe Tool

Wiring Tool

Color Copy Tool

Shortcut Menu Tool

Coloring Tool

01/11/2007

Digital Electronics and Computer Interfacing

13

1. LabVIEW basics

1.2 Block diagram

Pull-down menus

Window title
VI icon (right click
for short cut menu)
Toolbar

This is where the


program code is written

wire

Control terminals
01/11/2007

function
node

Indicator terminal

Digital Electronics and Computer Interfacing

14

1. LabVIEW basics

1.2.1 Block diagram toolbar


retain wire values saves data values
Step Over executes a node and pauses at the next node

debugging features

Highlight execution button


enables/disables execution highlighting
data flow will be visible

Step Out finishes executing the


current node and pauses
Step Into opens a node and pauses

Execution highlighting enabled

01/11/2007

Digital Electronics and Computer Interfacing

15

1. LabVIEW basics

1.2.2 Functions palette


right clicking in an empty area of the block
diagram opens the functions palette
choose the general type of node you want to insert:
1

1. Structures (For Loop, While Loop, Event Structure, etc.)


2. Array functions (Array size, Index Array, Build Array, etc.)
3. Cluster & Variant functions
4. Numeric functions (Add, Subtract, Multiply, etc.)
5. Boolean functions (AND, OR, XOR, etc.)
6. String functions (String length, Concatenate Strings, etc.)
7. Comparison functions (Equal, NOT equal, greater, etc.)
8. Instrument I/O (Data acquisition & interfacing)

9. User Libraries (your own VIs)

9
01/11/2007

place the actual object on the block diagram


Digital Electronics and Computer Interfacing

16

1. LabVIEW basics

1.2.3 Wiring objects


once you move the cursor over an input (or output)
terminal it changes to the wiring tool

left click starts a wire


moving the mouse creates a wire (dashed line)
left click again over an output (or input) terminal

01/11/2007

Digital Electronics and Computer Interfacing

17

1. LabVIEW basics

1.2.3 Wiring objects


wiring errors are indicated by broken wires

moving the wiring tool over a broken wire


displays a tip strip that describes why the
wire is broken

<CTRL>-B removes all broken wires on the


Block diagram

01/11/2007

Digital Electronics and Computer Interfacing

18

1. LabVIEW basics

1.2.3 Wiring objects


Wiring Hot Spot

Left Click To Select Wires

Clean Up Wiring

01/11/2007

Digital Electronics and Computer Interfacing

19

1. LabVIEW basics

1.2.4 Short cut menus


right clicking on terminals, function nodes
and wires opens different short cut menus
terminals:
- find the corresponding object on the front panel
- hide the corresponding object on the front panel
- change the properties of the object
etc.
function nodes:
- create a constant, control or indicator for
a particular input or output very useful
etc.
wires:
- create a constant, control or indicator
- clean up the wire
- set/clear breakpoints etc.
01/11/2007

Digital Electronics and Computer Interfacing

20

1. LabVIEW basics

1.3 Help
<CTRL>+H,
or Show Context Help from the
Help pull-down menu toggles the Context Help on and off
Move the cursor over the Block diagram object you are
interested in
Using <CTRL>+?, F1 or Search the LabVIEW from the
Help pull-down menu you can get more detailed help
Besides help for different LabVIEW components tutorials are also
available (PDF-files)
try for example to search for getting started how-to
Use Find examples from the Help pull-down menu to find example VIs for
a specific task
Make yourself familiar with the LabVIEW help!
01/11/2007

Digital Electronics and Computer Interfacing

21

1. LabVIEW basics

1.4 Debugging
Locating errors:
Click on broken Run button:
a Window that explains the error and possible solutions appears
Execution Highlighting:
Click on Execution Highlighting button; data flow is animated
using bubbles. Values are displayed on wires.

Probes:

Right-click on wire to display probe and it shows data


as it flows through wire segment
You can also select Probe tool
and click on the wire

from the Tools palette

If retain wire values is on


the last data flowed through
the wire at the last VI execution is shown immediately

01/11/2007

Digital Electronics and Computer Interfacing

22

1. LabVIEW basics

1.4 Debugging
Break points:
Right-click on a wire or node to set/clear a break point

Continue execution until the next break point or the end of the program
Step Into opens a node and pauses
Step Over executes a node and pauses at the next node
Step Out finishes executing the current node and pauses

01/11/2007

Digital Electronics and Computer Interfacing

23

You might also like