84 Chapter 6
Reading/Writing Measurement Data
Reading/Writing Data
Reading/Writing Data
Reading/writing measurement data
Reading/writing array in ASCII format
Example 6-1 shows the process of reading and writing array data in the ASCII format. This
program is available under the filename of “data_b2a.bas” on the sample program disk.
This program reads the data trace array for trace B in ASCII format and writes it to the data
trace array for trace A.
Lines 30 to 70 Identifies the external controller and Instrument BASIC and sets the
GPIB address.
Line 90 Substitutes the number of measurement points into the “Nop” variable.
Lines 110 to 120 Specifies ASCII format as data transfer format and sets the number of
measurement points to Nop.
Lines 140 to 150 Holds the trigger and displays traces A and B on separate screens.
Lines 160 to 190 Specifies trace B as active trace, performs auto scaling, and reads the
display format to assign it the “Fmt$” variable.
Lines 210 to 220 Reads the data trace array for trace B and stores it in Trc(*).
Lines 240 to 250 Specifies trace A as active trace and sets the display format to “Fmt$.”
Line 260 Writes “Trc(*)” to the data trace array for trace A.
Line 270 Performs auto-scaling.
Example 6-1 Reading/Writing Data Trace Array in the ASCII Format
10 DIM Trc(1:201,1:2),Fmt$[9]
20 INTEGER Nop
30 IF SYSTEM$("SYSTEM ID")="HP4294A" THEN
40 ASSIGN @Hp4294a TO 800
50 ELSE
60 ASSIGN @Hp4294a TO 717
70 END IF
80 !
90 Nop=201
100 !
110 OUTPUT @Hp4294a;"FORM4"
120 OUTPUT @Hp4294a;"POIN ";Nop
130 !
140 OUTPUT @Hp4294a;"HOLD"
150 OUTPUT @Hp4294a;"SPLD ON"
160 OUTPUT @Hp4294a;"TRAC B"
170 OUTPUT @Hp4294a;"AUTO"
180 OUTPUT @Hp4294a;"FMT?"
190 ENTER @Hp4294a;Fmt$
200 !
210 OUTPUT @Hp4294a;"OUTPDTRC?"
220 ENTER @Hp4294a;Trc(*)
230 !