IM 253401-01E
App1-14
Appendix 1.2 Sample Program
‘*********************************************************************
‘* WT110/WT130 *
‘* Program for D/A output adjusting *
‘* Turn ON the power while pressing the SHIFT key.
*
‘* 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$ = “CAL3”: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
D O
CLS
PRINT “D/A output adjustment”
PRINT “”
PRINT “1-12 : Assigning D/A channel”
PRINT “S : Adjustment values will be kept”
PRINT “C : Adjustment values will not be kept”
PRINT “Command >> “; : LINE INPUT CH$
IF CH$ = “S” THEN
CMD$ = “END”: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK: EXIT DO
ELSEIF CH$ = “C” THEN
CMD$ = “CAN”: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK: EXIT DO
ELSE
CH = VAL(CH$)
IF CH >= 1 AND CH <= 12 THEN
GOSUB DACH
END IF
END IF
LOOP
‘
PRGEND:
CALL IBLOC(WT%)
END
‘
DACH:
CH$ = STR$(CH)
CMD$ = “CH” + CH$: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “DO0”: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
PRINT “”
PRINT “+5V has been output to”; CH$; “channel”
PRINT “Measure”; CH$; “channel’s voltage”
PRINT “Measurement value = “; : LINE INPUT D$
CMD$ = “CD” + CH$ + “,” + D$: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
FOR I = 0 TO 2000: NEXT I
CMD$ = “ENT”: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
CMD$ = “DO1”: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
PRINT “”
PRINT “-5V has been output to”; CH$; “channel”
PRINT “Measure”; CH$; “channel’s voltage”
PRINT “Measurement value = “; : LINE INPUT D$
CMD$ = “CD” + CH$ + “,” + D$: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
FOR I = 0 TO 2000: NEXT I
CMD$ = “ENT”: CALL IBWRT(WT%, CMD$): GOSUB ERRCHK
RETURN
‘
‘ 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