THE CPL PROTOCOL

6 - 3

6.2 EXAMPLE PROGRAM FRAME

In the COMMAND REFERENCE SECTION a very short programming example is given for each command. All examples are written in GW-Basic and able to run on an IBM-compatible PC. The example program expects the oscilloscope to be connected via COM1 port (RS-232) with a RS-232 null modem cable and to be setup at 9600 baud, 8 databits, no parity, 3 wire, xon/xoff = off (Menu UTILITY).

The following program lines are an example frame work. The frame work lets you embed any of the example programs shown in the COMMAND REFERENCE SECTION.

Program frame:

10 OPEN "COM1:9600,N,8,1, CS0, DS0, CD0" AS #1:’open serial port *)

... Insert Example Programs Here

999

END

 

 

1000

’- synchronize on acknowledge &

handle error:

1010

INPUT#1,ACK

 

 

1020

IF (ACK=0) THEN GOTO 1110

 

 

1030

IF (ACK<0) OR (ACK>4) THEN GOTO

1100

1040

PRINT "ERROR: ";ACK;

 

 

1050

ON ACK GOTO 1060,1070,1080,1090

 

1060

PRINT "SYNTAX ERROR"

: END

1070

PRINT "EXECUTION ERROR"

: END

1080

PRINT "SYNCHRONISATION ERROR" : END

1090

PRINT "COMMUNICATION ERROR"

: END

1100

PRINT "UNKNOWN ACKNOWLEDGE"

: END

1110

RETURN

 

 

First the serial port of the PC is opened (line 10) with the settings of the oscilloscope communication parameters **)

Following that, the example program lines from the COMMAND REFERENCE SECTION can be executed.

The subroutine to synchronize on the <acknowledge> returned from the oscilloscope starts at line 1000.

*) The oscilloscope communication parameters are stored in battery backup memory when the oscilloscope is turned off. On power-up the parameters are restored.

Page 220
Image 220
Fluke PM3370B user manual Example Program Frame, Program frame