10    !  COPYDATA
20    !-------------------------------------------------------------------------
30    ! HPBASIC/IBASIC Programs; Copy Data
40    ! This program will copy measurement data to a data register. This program
50    ! will also distinguish between IBASIC and HPBASIC run modes
60    !-------------------------------------------------------------------------
70    !
90    ON ERROR GOTO Not_ibasic     ! auto selection of proper select code
100   Device=800                   ! device select code from IBASIC
110   CLEAR Device
120   GOTO Start_prog
130   !
140 Not_ibasic: !
150   Device=711                   ! device select code from external computer
160 Start_prog: !
170   OFF ERROR
180   !
190   !
200   ASSIGN @Analyzer TO Device   ! allows code to be address independent
210   !
230   OUTPUT @Analyzer;"*RST"                 ! Reset the analyzer
240   OUTPUT @Analyzer;"ABORT;:INIT; *WAI"    ! start measurements
250   ! copy trace A to data reg 1
260   OUTPUT @Analyzer;"TRAC D1, TRAC1"
270   !
280   ! select the upper/lower display format
290   OUTPUT @Analyzer;"DISP:FORM ULOW"
292   !
294   ! !display D1 in trace B
300   OUTPUT @Analyzer;"CALC2:FEED 'D1';MATH:STAT OFF; *WAI"
310   !
330   END
