Remote Control
Programming Examples
6
6-43
Programming Examples
The following examples are related to an IBM-compatible PC. The first one uses the
built-in IEEE-488 Interface, the second one uses the standard serial port of the controller
and the RS-232 Interface. You should have basic knowledge of the MS-DOS operating
system of your controller and the programming language QuickBasic (version 4.0 and
above) to understand the examples that follow.
Example for the IEEE-488 Interface
DECLARE SUB SendCmd (WR$)
DECLARE SUB SendStr (WR$)
DECLARE SUB ErrChk (Cs!, Sts%)
REM $INCLUDE: 'qbdecl4.bas'
CLS
PRINT " "
PRINT " "
PRINT " ***** DEMO PROGRAM FOR FLUKE 54200/100 *****"
PRINT
PRINT " PRESS 'RETURN' TO CONTINUE "
PRINT
PRINT " To leave running program type 'END' or 'end' "
BEEP
PRINT
DO 'waiting for 'RETURN'
B$ = ""
DO UNTIL B$ <> ""
B$ = INKEY$
LOOP
LOOP UNTIL B$ = CHR$(13)
CLS 'clears screen
Stp = 0
BDNAME$ = "GEN1" 'name of the device on the conf.table
CALL IBFIND(BDNAME$, GEN%) 'open device
CALL ErrChk(1, GEN%) 'check error
IF Stp = 0 THEN
CALL IBCLR(GEN%) 'send interface clear
CALL ErrChk(2, IBSTA%) 'check error
END IF
IF Stp = 0 THEN
A$ = "*ese 255" 'initialize ESR register
CALL SendCmd(A$) 'send command
A$ = "*cls" 'clear status register
CALL SendCmd(A$) 'send command
A$ = "*IDN?" 'ask for identity
CALL SendStr(A$) 'send command string
WHILE Stp = 0
LINE INPUT "COMMAND : ", A$ 'reading keyboard input
IF A$ = "END" OR A$ = "end" THEN
CALL IBLOC(GEN%) 'set instrument to 'LOCAL'
CLS 'clear screen
Stp = 1
ELSE
CALL SendStr(A$) 'send command string
END IF
PRINT
PRINT
WEND
END IF
END