JCB 30304
DATA ACQUISITION SYSTEM
CHAPTER 6
WAVEFORMS
CHAPTER 6 WAVEFORMS
Waveform Dynamic
types data
Signal
Generation /
Processing
4Fourier
analysis
“The great aim of education is not knowledge but action” ~Herbert Spencer
INTRODUCTION
• Graphical display of data is an important aspect of programming in
LabVIEW.
• A good knowledge of arrays and clusters is important for graphical
operations.
• VIs with graph usually collects the data in an array and then plots the data
to the graph to obtain a waveform.
• Two-dimensional X-Y displays are required in most situations.
• Charts and graphs let you display plots of data in a graphical form.
• Charts interactively plot data, appending new data to old so that you can
see the current value in the context of previous data, as the new data
become available.
• Graphs plot pre-generated arrays of values in a more traditional fashion
without retaining previously-generated data.
Waveform Types
Laziness may appear attractive, but work gives satisfaction
TYPES OF WAVEFORMS
• Waveform graphs and charts: Display data
typically acquired at a constant rate.
• XY Graphs: Display data acquired at a non-
constant rate and data for multivalued functions.
• Intensity graphs and charts: Display 3D data on a
2D plot by using color to display the values of the
third dimension.
• Digital waveform graphs: Display data as pulses
or groups of digital lines.
• Windows 3D Graphs: Display 3D data on a 3D
plot in an ActiveX object on the front panel.
Waveform Charts
Selected from the Controls»Graphs and Charts palette
6
Wiring to Charts
Single-Plot Chart
Multiple-Plot Chart
7
Modifying Chart Properties
• Change the
appearance
• Set the format and
precision of the axis
• Choose the plot type
• Edit the scales
• Document the chart
8
Customizing Charts and Graphs
Right-click and select Visible Items to view the following
items:
• Plot Legend Graph Palette
• Digital Display
• Scrollbar Zoom
Subpalette
• X and Y Scale
• Graph Palette
• Scale Legend Scale Legend
9
Graphs
• Selected from the Graph subpalette
• Waveform Graph – Plot an array of numbers against their indices
• XY Graph – Plot one array against another
Plot Legend
(point and line
styles)
Graph Palette
Scale Legend
10
Single-Plot Waveform Graphs
Uniform X axis
Initial X = 0.0
Delta X = 1.0
Uniform X axis
you specify point
spacing
11
Multiple-Plot Waveform Graphs
Each row is a
separate plot:
Initial X = 0
Delta X = 1
Each row is a
separate plot:
Bundle specifies
point spacing of
the X axis
12
XY Graphs
• Non-uniform X axis
• Separate X and Y arrays
define data points
13
Chart and Graph Use Summary
Use the Context Help window with charts and graphs
14
Summary
• The waveform chart is a special numeric indicator that displays one
or more plots. The waveform chart has the following three update
modes:
–A strip chart shows running data continuously scrolling from left to
right across the chart.
–A scope chart shows one item of data, such as a pulse or wave,
scrolling partway across the chart from left to the right.
–A sweep works similarly to a scope except it shows the old data on
the right and the new data on the left separated by a vertical line.
• Waveform graphs and XY graphs display data from arrays.
• Right-click a waveform chart or graph or its components to set
attributes of the chart and its plots.
15
Exercise
1. Problem 7.1 Page 153
2. Problem 7.2 Page 153
3. Problem 7.3 page 154
4. Problem 7.4 Page 155
Signal Generation /
Processing
Read the Qur’an It will show u how simple life can be.
Signal Generation
• The generation of signals is an important part of
any test or measurement system.
• The following applications are examples of uses
for signal generation:
– Simulate signals to test your algorithm when real-
world signals are not available, for example, when you
do not have a DAQ device for obtaining real-world
signals or when access to real-world signals is not
possible.
– Generate signals to apply to a digital-to-analog (D/A)
converter.
Dynamic Data
“Creativity is intelligence having fun.” — Albert Einstein
Dynamic Data
• Most Express VIs accept and/or return the dynamic data
type, which appears as a dark blue terminal.
• Using the Convert to Dynamic Data and Convert from
Dynamic Data VIs, you can convert floating-point numeric
or Boolean data of the following data types :
■ 1D array of waveforms
■ 1D array of scalars
■ 1D array of scalars – most recent value
■ 1D array of scalars – single channel
■ 2D array of scalars – columns are channels
■ 2D array of scalars – rows are channels
■ Single scalar
■ Single waveform
Dynamic Data
• Wire the dynamic data type to an indicator that can best
present the data.
• Indicators include a graph, chart, or numeric, or Boolean
indicator.
• However, because dynamic data undergoes an automatic
conversion to match the indicator to which it is wired,
Express VIs can slow down the block diagram execution
speed.
• The dynamic data type is for use with Express VIs. Most
other VIs and functions that are shipped with LabVIEW do
not accept this data type.
• To use a built-in VI or function to analyze or process the
data the dynamic data type includes, you must convert the
dynamic data type.
Convert to and from Dynamic Data Types
Exersice
4 STRINGS AND FILE I/O
“Never give up on a dream just because of the time it will take to accomplish it. The time will pass anyway.” — Earl Nightingale
Strings and File I/O
• How to create string controls and indicators
• How to use several String functions
• About file I/O operations
• How to use the high-level File I/O VIs
• How to use the low-level File I/O VIs
• How to format text files for use in
spreadsheets
25
Strings
• A string is a sequence of displayable or - characters (ASCII)
• Many uses — displaying messages, instrument control, file I/O
• String control/indicator is in the Controls»String subpalette
26
String Display Modes
Normal display \ code display
Hex display
Password display
27
String Functions
String Length
Concatenate Strings
(spaces here)
28
String Functions
String Subset
Match Pattern
29
Converting Numerics to Strings: Build String
30
Converting Strings to Numerics:
Scan From String
31
Edit Format String
Scan From String Function
32
File Input and Output
Four Hierarchy Levels:
High-level File VIs
Intermediate File VIs and Functions
Advanced File Functions subpalette
Express VIs
33
High-level File I/O VIs
• Write to Spreadsheet File
• Read from Spreadsheet File
• Write Characters to File
• Read Characters from File
• Read Lines from File
34
File I/O Programming Model -
Intermediate
Open/ Read
Close Check for
Create/ and/or
File Errors
Replace File Write to File
35
Write to File Example
• Open/Create/Replace opens the existing file [Link] and
generates refnum and error cluster
• Write File writes the data
• Close File closes the file
• Simple Error Handler checks for errors
36
Reading Data from a File
• Open/Create/Replace opens the file
• Read File reads the specified number of bytes from the file
• Close File closes the file
• Simple Error Handler checks for errors
37
Formatting a Spreadsheet String
• Spreadsheets are popular tools for data handling and analysis
• There are many formats for spreadsheet data. One of the most
popular is tab-delimited:
– Columns are separated by a tab character
– Rows are separated by an end-of-line
character
A spreadsheet yields:
Tab End of Line
38
Creating a Spreadsheet File
Can replace Format Into String and
Write File with Format Into File
in above example
39
Write LabVIEW Measurement File
• Includes the open, write, close and error handling
functions
• Handles formatting the string with either a tab or
comma delimiter
• Merge Signals function is used to combine data into
the dynamic data type
40
Summary
• Strings group sequences of ASCII characters. Use the string control
and indicator located on the Controls»String & Path palette to
simulate text entry boxes and labels.
• Use the String functions located on the Functions»String palette to
edit and manipulate strings on the block diagram.
• Use the Format Into String function and the Build String Express VI to
convert a numeric to a string.
• Use the Scan From String function to convert a string to a numeric.
• Right-click the Format Into String or Scan From String function and
select Edit Format String or Edit Scan String from the shortcut menu
to create or edit a format string.
41
Summary, cont.
• Use the File I/O VIs and functions located on the Functions»File I/O
palette to handle all aspects of file I/O.
• When writing to a file, you open, create, or replace a file, write the
data, and close the file. Similarly, when you read from a file, you open
an existing file, read the data, and close the file.
• To access a file through a dialog box, do not wire file path in the
Open/Create/Replace File VI.
• To write data to a spreadsheet file, you must format the string as a
spreadsheet string, which is a string that includes delimiters, such as
tabs. Use the Format Into File function to format string, numeric, path,
and Boolean data as text and write the text to a file
42
What’s Your
THANK YOU Message?