7-68 Chapter7
Programming Examples
Measurement Data Transfer Examples
190 !
200 OUTPUT @Nwa;"OPC?;SING;" ! Single sweep and wait
210 ENTER @Nwa;Reply ! Read the 1 when completed
220 !
230 OUTPUT @Nwa;"FORM1;" ! Select internal binary format
240 OUTPUT @Nwa;"OUTPDATA;" ! Output error corrected data
250 !
260 ! Read in the data header two characters and two bytes for length
270 ! "#,2A"
280 ! # no early termination, terminate when ENTER is complete
290 ! 2A read two chars
300 !
310 ENTER @Nwa_bin USING "#,2A";Header$ ! Read header as 2 byte string
320 ENTER @Nwa_bin;Length ! Read length as 2 byte integer
330 PRINT "Header ";Header$,"Array length";Length
340 !
350 ALLOCATE Data$[Length] ! String buffer for data bytes
360 ! "+,-K" format statement
370 ! + EOI as a terminator LF is suppressed and read as data
380 ! -K All characters are read and not interpreted LF is included
390 ENTER @Nwa_bin USING "+,-K";Data$ ! Read trace into string array
400 !
410 PRINT "Number of bytes received ";LEN(Data$)
420 !
430 OUTPUT @Nwa;"CONT;" ! Restore continuous sweep
440 OUTPUT @Nwa;"OPC?;WAIT;" ! Wait for the analyzer to finish
450 ENTER @Nwa;Reply ! Read the 1 when complete
460 !
470 LOCAL @Nwa ! Release HP-IB control
480 END