Summary: In this exercise, the objective is to graph a waveform that an instrument such as a digital oscilloscope returns as an ASCII or binary string.
For the ASCII waveform string, the waveform consists of 128 points. Up to four ASCII characters separated by commas represent each point. The following header precedes the data points:
CURVE {12,28,63,...128 points in total...,}CR LF
For the binary waveform string, the waveform consists of 128 points. Each point is represented as a 1-byte unsigned integer. The following header precedes the data points:
CURVE % {Bin Count MSB}{Bin Count LSB}{åå¤Å...128 bytes in total...} {Checksum} CR LF
Complete the following steps to examine a VI that converts the waveform to an array of numbers. The VI graphs the array and reads the waveform string from the NI Instrument Simulator or from a previously stored array.
![]() |
Waveform Example VI located in the
C:\Exercises\LabVIEW Basics I directory. The
front panel shown in Figure 2 is already
built.
![]() |
![]() |
String Subset
function located on the Functions>>All
Functions>>String palette returns a substring of
128 elements starting from the fifth byte of the binary
waveform string, excluding the header and trailer bytes.
String to Byte Array
function, located on the Functions>>All
Functions>>String>>String/Array/Path Conversion
palette, converts the binary string to an array of
unsigned integers.
String Length
function, located on the Functions>>All
Functions>>String palette, returns the number of
characters in the waveform string.
Extract Numbers VI,
located in the Exercises directory,
extracts numbers from the ASCII waveform string and
places them in an array. Non-numeric characters, such as
commas, separate numbers in the string.
VISA Write and VISA Read
functions, located on the Functions>>All
Functions>>Instrument I/O>>VISA palette, query
the NI Instrument Simulator for a square wave in either
ASCII or 1-byte binary format.
The Simple Error Handler
VI, located on the Functions>>All
Functions>>Time & Dialog palette, reports any
errors.
Data Format to ASCII and run
the VI. The ASCII waveform string displays, the VI converts
the values to a numeric array, and displays the string
length and numeric array.
Data Format to Binary and run
the VI again. The binary waveform string and string length
display, the VI converts the string to a numeric array, and
displays it in the graph.
"A full introductory course on programming with LabVIEW."