54200
Users Manual
6-46
Example for the RS-232 Interface
DECLARE FUNCTION TestCmd! (A$)
DECLARE SUB RecDat (St%)
DECLARE SUB SendCmd (Cmd%, Rsp%)
DECLARE SUB SendStr (WR$)
DECLARE SUB InitCom ()
DECLARE SUB ClrBuf ()
CLS
PRINT " "
PRINT " "
PRINT " ***** Demonstration Program for FLUKE 54200/100 *****"
PRINT " ***** with RS-232 Interface *****"
PRINT
' Enviroment : IBM AT or Compatible with Quick Basic 4.5
Stp = 0
A$ = ""
CALL InitCom 'open device
CALL ClrBuf 'clear input buffer
ErrSts% = 0
CALL SendCmd(4, 0) 'send interface clear
CALL SendCmd(2, 0) 'sets instrument to remote
A$ = "*ese 255" 'initialize ESR register
CALL SendStr(A$) 'send command
IF ErrSts% > 0 THEN 'if no answer
PRINT "Please check the connection and setting!"
ELSE
CLS 'clears screen
A$ = "*cls" 'clear status register
CALL SendStr(A$) 'send command
A$ = "*IDN?" 'ask for identity
CALL SendStr(A$) 'send command string
WHILE Stp = 0
LINE INPUT "COMMAND : ", A$ 'reading keyboard input
Cmd% = TestCmd(A$) 'test command
SELECT CASE Cmd%
CASE 0
CALL SendCmd(1, 1) 'set instrument to 'LOCAL'
CLOSE #1
CLS 'clear screen
Stp = 1
CASE 4
CALL SendCmd(Cmd%, 1) 'send command
CALL ClrBuf 'clear input buffer
CASE 1 TO 8
CALL SendCmd(Cmd%, 1) 'send command
CASE IS > 8
CALL SendStr(A$) 'send command string
END SELECT
PRINT
PRINT
WEND
END IF
END