User's Manual

R e m o t e C o n t r o l a n d P r o g r a m m i n g R e f e r e n c e f o r t h e F L U K E 1 9 0 f a m i l y o f S c o p e M e t e r ® t e s t t o o l s
p a g e 5 4
‘***************** Beginning of example program *****************
CLS ‘Clears the PC screen.
OPEN “COM1:1200,N,8,1,CS,DS,RB2048” FOR RANDOM AS #1
PRINT #1, “PC 12345” ‘Sends a baud rate value that is
‘out of range for the ScopeMeter.
GOSUB Acknowledge.Status ‘Input acknowledge from ScopeMeter
‘and the status value if the
‘acknowledge value is non-zero.
END
‘******************* Acknowledge subroutine *********************
‘Use this subroutine after each command or query sent to the
‘ScopeMeter. This routine inputs the acknowledge response from
‘the ScopeMeter. If the response is non-zero, the previous
‘command was not correct or was not correctly received by
‘the ScopeMeter. Then an error message is displayed and
‘the program is aborted.
Acknowledge:
INPUT #1, ACK ‘Reads acknowledge from ScopeMeter.
IF ACK <> 0 THEN
PRINT “Error “; ACK; “: “;
SELECT CASE ACK
CASE 1
PRINT “Syntax Error”
CASE 2
PRINT “Execution Error”
CASE 3
PRINT “Synchronization Error”
CASE 4
PRINT “Communication Error”
CASE IS < 1
PRINT “Unknown Acknowledge”
CASE IS > 4
PRINT “Unknown Acknowledge”
END SELECT
GOSUB Status.display ‘Further specifies the error.
PRINT “Program aborted.”
END
END IF
RETURN
‘************** Displays ScopeMeter status *****************
‘This subroutine gives you further detail in case the
‘acknowledge reply from the ScopeMeter is non-zero.
Status.display:
PRINT #1, “ST” ‘Sends the STATUS query.
GOSUB Acknowledge.Status ‘Inputs acknowledge from ScopeMeter.
INPUT #1, STAT ‘Inputs status value.
PRINT “Status “ + STR$(STAT) + “: “;
IF STAT = 0 THEN PRINT “No error”
IF (STAT AND 1) = 1 THEN PRINT “Illegal Command”
IF (STAT AND 2) = 2 THEN PRINT “Data format of parameter is wrong”
END IF
IF (STAT AND 4) = 4 THEN PRINT “Parameter out of range”
IF (STAT AND 8) = 8 THEN PRINT “Invalid command in this CPL interface”
END IF
IF (STAT AND 16) = 16 THEN PRINT “Command not implemented”
IF (STAT AND 32) = 32 THEN PRINT “Invalid number of parameters”
END IF
IF (STAT AND 64) = 64 THEN PRINT “Wrong number of data bits”
END IF
IF (STAT AND 512) = 512 THEN PRINT “Conflicting instrument settings”
END IF
IF (STAT AND 16384) = 16384 THEN PRINT “Checksum error”
END IF
RETURN
‘******************** End of example program ********************