7-62
Chapter 7
Programming Examples
Measurement Data Transfer Examples
Example 3C: Data Transfer Using Floating-Point Numbers
This example program illustrates data transfer using FORM 3 in which data is
transmitted in the floating-point formats. FORM 2 is nearly identical except for the IEEE
32-bit format of 4 bytes-per-value. FORM 5 reverses the order of the bytes to conform with
the PC conventions for defining a real number.
The block-data formats have a four-byte header. The first two bytes are the ASCII
characters “#A” that indicate that a fixed-length block transfer follows, and the next two
bytes form an integer containing the number of bytes in the block to follow. The header
must be read in so that data order is maintained.
This transfer is more than twice as fast than a FORM 4 transfer. With the FORM 4
transfer, 10,050 bytes are sent (201 points
×
2 values-per-point
×
24 bytes-per-value).
Using FORM 2 to transfer the data, only 1612 bytes are sent (201 points
×
2
values-per-point
×
4 bytes-per-value). See
“Array-Data Formats” on page 4-6
The following is an outline of the program's processing sequence:
• An I/O path is assigned for the analyzer.
• The system is initialized.
• The integer variables are defined to contain the header information.
• The number of points in the trace is set to 11.
• The selected frequency span is swept once.
• Data-transfer format 3 is set.
• The headers are read from the trace.
• The array size is calculated and allocated.
• The trace data is read in and printed.
• The marker is activated and placed at the lowest frequency of the analyzer (50 MHz).
• The instrument is returned to local control and the program ends.
Running the Program
Run the program. The computer displays the number of elements and bytes associated
with the transfer of the trace, as well as the first 10 data points. Position the marker and
examine the data values. Compare the displayed values with the analyzer's marker values.
BASIC Program Listing
10
! This program shows how to read in a data trace in IEEE 64 bit
20
! format. The array header is used to determine the length of the
30
! array and to allocate the array size.
40
!
50
! Program Example 3C
60
!
70
CLEAR SCREEN
80
! Initialize the analyzer
90
ASSIGN @Nwa TO 716
! Assign an I/O path for the analyzer
100 ASSIGN @Nwadat TO 716;FORMAT OFF
! Binary data path definition
110 !
Summary of Contents for 8719ES
Page 15: ...1 1 1 Alphabetical Command Reference ...
Page 293: ...2 1 2 Introduction to Instrument Control ...
Page 310: ...3 1 3 GPIB Programming ...
Page 334: ...4 1 4 Reading Analyzer Data ...
Page 343: ...5 1 5 Data Processing Chain ...
Page 350: ...6 1 6 Error Reporting ...
Page 364: ...7 1 7 Programming Examples ...
Page 502: ...A 1 A Preset Conditions ...
Page 517: ...B 1 B Command Listings ...