IM 253401-01E
App1-11
App
Appendix 1.2 Sample Program
Communication Commands 1
Sample Program
‘*********************************************************************
‘* WT110/WT130 *
‘* Program to read measurement data 10 times and then display them
*
‘* Microsoft QuickBASIC 4.0/4.5 Version *
‘*********************************************************************
REM $INCLUDE: ‘qbdecl4.bas’
BORD$ = “GPIB0”: CALL IBFIND(BORD$, BD%)
IF BD% < 0 THEN GOTO ERRDISP
CALL IBSIC(BD%): GOSUB ERRCHK
DEVICE$ = “WT”: CALL IBFIND(DEVICE$, WT%)
IF WT% < 0 THEN GOTO ERRDISP
CALL IBCLR(WT%): GOSUB ERRCHK
‘
CMD$ = “HD0” ‘ Hold OFF
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “FL0” ‘ Filter OFF
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “SC0” ‘ Scaling OFF
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “AG0” ‘ Averaging OFF
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “DA1;EA1” ‘ Display A = V1
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “DB2;EB1” ‘ Display B = A1
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “DC3;EC1” ‘ Display C = W1
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “RV7;RA7” ‘ Measurement range = 150V/5A
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “MN0” ‘ Measurement mode = RMS
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
‘ Output items for comm. = default setting for normal measurement
CMD$ = “OFD0”
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
‘ Delimiter for Comm. output = CR+LF+EOI
CMD$ = “DL0”
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
BUF$ = SPACE$(255)
FOR I = 1 TO 10
FOR J = 0 TO 5000: NEXT J ‘ Waiting
CMD$ = “OD”
CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
DO
CALL IBRD(WT%, BUF$): GOSUB ERRCHK
PRINT LEFT$(BUF$, IBCNT% - 2)
LOOP WHILE LEFT$(BUF$, 3) <> “END”
NEXT I
PRGEND:
CALL IBLOC(WT%)
END
‘
‘ When IBFIND call failed
ERRDISP:
PRINT “ ===== No such board or device name ===== “
GOTO PRGEND
‘
‘ GP-IB error check
ERRCHK:
IF IBSTA% >= 0 THEN RETURN
PRINT “ ===== Error ===== “
GOTO PRGEND