Professional Documents
Culture Documents
JCB 30304 Data Acquisition System: Chapter 1: Introduction Miss Nur Fazira Haris
JCB 30304 Data Acquisition System: Chapter 1: Introduction Miss Nur Fazira Haris
JCB 30304
DATA ACQUISITION SYSTEM
CHAPTER 1 : INTRODUCTION
MISS NUR FAZIRA HARIS
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
CHAPTER 1 : INTRODUCTION
1. Tools, controls and functions palette
2. Data Types
3. Conversation
4. Parallel data flow
5. Create indicator/controls/constant
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Objectives:
Develop an idea of what LabVIEW really is.
Learn what "graphical programming language" and "dataflow
programming" mean.
Peruse the introductory examples that come installed with LabVIEW using
the NI Example Finder.
Get a feel for the LabVIEW environment.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
WHAT IS LabVIEW?
LabVIEW, short for Laboratory Virtual Instrument Engineering Workbench, is a
programming environment in which you create programs using a graphical
notation (connecting functional nodes via wires through which data flows).
In this regard, it differs from traditional programming languages like C, C++, or
Java, in which you program with text.
LabVIEW is much more than a programming language. It is an interactive
program development and execution system designed for people, like scientists
and engineers, who need to program as part of their jobs.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
WHAT IS LabVIEW?
C language
Dataflow programming language
Cross-platform
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
WHAT IS LabVIEW?
The LabVIEW development environment works on computers running Windows,
Mac OS X, or Linux. LabVIEW can create programs that run on those platforms,
as well as Microsoft Pocket PC, Microsoft Windows CE, Palm OS, and a variety of
embedded platforms, including Field Programmable Gate Arrays (FPGAs), Digital
Signal Processors (DSPs), and microprocessors.
Using the very powerful graphical programming language that many LabVIEW
users affectionately call "G" (for graphical), LabVIEW can increase your
productivity by orders of magnitude.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
WHAT IS LabVIEW?
Programs that take weeks or months to write using conventional programming
languages can be completed in hours using LabVIEW because it is specifically
designed to take measurements, analyze data, and present results to the user.
And because LabVIEW has such a versatile graphical user interface and is so easy
to program with, it is also ideal for simulations, presentation of ideas, general
programming, or even teaching basic programming concepts.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
WHAT IS LABVIEW?
LabVIEW program imitate the appearance and operation of physical
instruments, such as oscilloscope and multimeters, LabVIEW programs are
called virtual instruments, or more commonly VI.
VIs have front panels and block diagrams. The front panel is the user
interface. The block diagram is the programming behind the user
interface.
After you build the front panel, you add code using graphical
representations of functions to control the front panel objects.
The front panel code on the block diagram is graphical code, also known
as G code or block diagram code.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
LabVIEW CHARACTERISTICS
LabVIEW have the following characteristics:
A graphical and compile nature
Represented graphically, with icon and wire instead of with text.
Dataflow and/or event-based programming
LabVIEW programs execute according to dataflow programming instead of the procedural approach
found in most text based-programming.
Multi-target and platform capabilities
LabVIEW application can target multicore processors and other parallel hardware.
Object-oriented flexibility
LabVIEW provides tools and functions so that you can use object-oriented programming techniques in
G code.
Multi-threading possibilities
Enables code to have automatic parallelism. In LabVIEW environment, the compiler and execution
system working together, automatic run codes in parallel when possible.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
LabVIEW Conventions
Front panel items
Controls and indicators
Wiring colors
Wires are color coded to correspond to data types
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Ctrl+E
Run Stop
Reorder objects
Debugging features
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Front Panel
• Controls = Inputs
• Indicators = Outputs
Block Diagram
• Accompanying “program” for
front panel
• Components “wired” together
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Tools Palette
• LabVIEW automatically selects the tool needed
• Available on the front panel and the block diagram
• A tool is a special operating mode of the mouse cursor
• Use the tools to operate and modify front panel and
block diagram objects
• To show the tools palette, select
Window»Show Tools Palette
27
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
TOOLS PALETTE
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
CONTROL PALETTE
Insert a boolean control
(button or switch)
Insert a digital
indicator or control
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Add a numeric
FUNCTION PALETTE operator (+,-,…)
Add a structure such as for,
while, and case statements Add a boolean
operator (and, or…)
Timing/dialog
Comparison
File I/O
Signal analysis
Data Acquisition
Mathematical
Functions
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
subpalettes
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
TOOLBAR
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
SUBPALETTES
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
TERMINAL
The terminals represent the data type of the control or indicator.
You can configure front panel controls or indicators to appear as icon or data
type terminals on the block diagram.
By default, front panel objects appear as icon terminals. For example,
a knob icon terminal, shown as follows, represents a knob on the front
panel.
The DBL at the bottom of the terminal represents a data type of double-precision,
floating-point numeric.
A DBL terminal, shown as follows, represents a double-precision, floating-point
numeric control.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Terminals
When you place a control (or indicator) on
the FRONT PANEL
LabVIEW automatically creates a
corresponding control (or indicator)
terminal on the BLOCKDIAGRAM
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Control? or Indicator?
Invisible to user
Wiring Connections
Wires transport data through the block diagram
Wires
NODES
Nodes are objects on the block diagram that have inputs and/or outputs
and perform operations when a VI runs.
They are analogous to statements, operators, functions, and subroutines
in text-based programming languages.
The Add functions in the previous figure are examples of nodes.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
WIRES
You transfer data among block diagram objects through wires. In the
previous figure, wires connect the control and indicator terminals to the
Add functions.
Each wire has a single data source, but you can wire it to many VIs and
functions that read the data.
Wires are different colors, styles, and thicknesses, depending on their
data types.
A broken wire appears as a dashed black line with a red X in the middle.
Broken wires occur for a variety of reasons, such as when you try to wire
two objects with incompatible data types.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Wiring Techniques
Automatic Wiring
Use Context Help Window when wiring
Right-click wire and select Clean Up Wire
Tip Strips
Automatic wire routing
Right-click terminals and select Visible
Items»Terminals
Broken wires
If you connect more than
one source or no source
at all to a wire,
LabVIEW
DISAGREES with what you’re
doing, and the
wire will appear broken
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
TRY THIS
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
RUN BUTTON
The Run button, which looks
like an arrow, starts VI
execution when you click on
it
Dataflow Programming
•Block diagram executes dependent on
the flow of data; block diagram does
NOT execute left to right
Context Help
To display the Context Help window, select
Help»Show Context Help, press the <Ctrl-H> keys, or press the Show
Context Help Window button in the toolbar
Move cursor over object
to display help
Connections:
Required – bold
Recommended – normal
Optional - dimmed
52
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
LabVIEW Help
Click the More Help button in the Context Help window
Select Help»VI, Function, & How-To Help
Click the sentence Click here for more help in the Context Help window.
Debugging Techniques
Finding Errors
Click on broken Run button. A window showing the error appears Execution
Highlighting
Debugging Techniques
Probe
Right-click on wire and select probe and it shows data as it flows through the wire segment
Breakpoints
Right-click on wire and select Set Breakpoint; pause execution at the breakpoint.
Conditional Probe
Combination of a breakpoint and a probe. Right-click on wire and select custom probe.
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Debugging Techniques
Step Into, Over, and Out buttons for Single Stepping
Control Indicator
Terminals Terminals
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
Example 1: Craps
From the functions – numeric
panel insert a pair of dice
From the Controls panel insert a
numeric digital indicator (on the
front panel)
Use the wiring tool to connect
the two (in the wiring diagram)
and click the “run” button
repeatedly.
Numbers from 0.00 to 1.00
should be displayed in the front
panel
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
EXERSICE 1
Exercise 1 - Convert °C to °F
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
EXERSICE 2
Exercise 2: Simple Calculator VI
Create program simulating basic calculator
Able to add, subtract, and multiply
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
EXERSICE 3
Exercise 3: Simple Calculator VI
Front panel of program must have:
1 slide to control 3 different arithmetic operations (add +; subtract -; multiply *)
3 LED (Boolean) indicators to show which arithmetic operation is selected
Two numeric controls for inputting numbers
One numeric indicator to display results
Back panel should have:
A case statement to control arithmetic operations
UNIVERSITI KUALA LUMPUR (UNIKL), MALAYSIAN INSTITUTE of INDUSTRIAL TECHNOLOGY (MITEC)
THANK YOU