Chapter 7 7-59
Programming Examples
Measurement Data Transfer Examples
Example 3B: Data Transfer Using FORM 4 (ASCII Transfer)
This example shows you how to transfer a trace array from the analyzer using FORM 4, an
ASCII data transfer.
The next most common data transfer is to transfer a trace array from the analyzer.
Table 7-10 shows the relationship of the two values-per-point that are transferred to the
analyzer. When FORM 4 is used, each number is sent as a 24-character string, each
character represented by a digit, sign, or decimal point. Each number is separated from
the previous number with a comma. Since there are two numbers-per-point, a 201-point
transfer in FORM 4 takes 10,050 bytes. This form is useful only when input-data
formatting is difficult with the instrument controller. Refer to Table 7-10 for a comparison
with the other formats.
An example of a simple data transfer using FORM 4 (ASCII data transfer) is shown in this
program. A fairly common requirement is to create frequency-amplitude data pairs from
the trace data. No frequency information is included with the trace data transfer, because
the frequency data must be calculated. Relating the data from a linear frequency sweep to
frequency can be done by querying the analyzer start frequency, the frequency span, and
the number of points in the sweep. Given that information, the frequency of point N in a
linear frequency sweep is:
Example 3B illustrates this technique. It is a straight-forward solution for linear uniform
sweeps. For other sweep types, frequency data is more difficult to construct and may best
be read directly from the analyzer's limit-test array. See “Example 3D: Data Transfer
Using Frequency-Array Information” on page 7-64.
The following is an outline of the program's processing sequence:
• An I/O path is assigned for the analyzer.
• The system is initialized.
Table 7-10 Analyzer Array-Data Formats
Format
type
Type of Data Bytes per
Data Value
Bytes per
point 2 data
values
(201 pts)
Bytes per trace
Total Bytes
with header
FORM 1 Internal Binary 3 6 1206 1210
FORM 2 IEEE 32-bit
Floating-Point
4 8 1608 1612
FORM 3 IEEE 64-bit
Floating-Point
8 16 3216 3220
FORM 4 ASCII Numbers 24
(Typical)
50
(Typical)
10,050
(Typical)
10,050*
(Typical)
FORM 5 PC-DOS 32-bit
Floating-Point
4 8 1608 1612
*No header is used in FORM 4.
F StartFrequency N 1–()
Span
Points 1–()
------------------------------
×+=