Keithley 2002 User Manual page 325

Hide thumbs Also See for 2002:
Table of Contents

Advertisement

Example Programs
Test Digital Input Port
Microsoft QuickBASIC 4.5
Keithley KPC-488.2 Interface
©1992, Keithley Instruments, Inc.
Description
This program continuously tests the digital input port of the
Model 2002. Each test provides the status of the read opera-
tion. If Status = 0, then the read operation was successful.
Also displayed is the result of the read operation. If the dig-
ital input port is high (on), then Databyte = 1. Conversely, if
the input port is low (off), then Databyte = 0.
Pressing any key on the computer keyboard terminates the
program.
Required equipment
• Model 2002 Multimeter
Program (testdio2.bas)
'$INCLUDE: 'ieeeqb.bi'
CLS
CALL initialize(21, 0)
CALL SETTIMEOUT(1000)
CALL setoutputEOS(10, 0)
CALL setinputEOS(10)
CALL send(16, "*RST; *CLS; :syst:pres", status%) ' Clear and reset 2002
z = 0
rdata$ = SPACE$(8)
WHILE INKEY$ = ""
z = z + 1
CALL send(16, ":sens2:ttl1:data?", status%)
GOSUB test.status
t! = TIMER: WHILE TIMER - t! <= .5: WEND
CALL enter(rdata$, 3, 16, status%)
GOSUB test.status
PRINT "Test #"; z; " Status "; status%; " Databyte "; rdata$
WEND
test.status:
IF status% <> 0 THEN
PRINT " Failure on IEEE-Bus !!! Status = "; status%
SLEEP 3
STOP
END IF
RETURN
G-8
• Microsoft QuickBASIC 4.5
• Any one of the following IEEE-488 interfaces:
Keithley Model KPC-488.2
Keithley Model KPC-488.2AT
Capital Equipment Corporation PC<>488
The program assumes that the Model 2002 is set to address
16.
Loading user library
The user library for QuickBASIC 4.5 is provided with the
IEEE-488 interface (ieeeqb.qlb). Assuming QuickBASIC
and the user library are in the same DOS directory, enter the
following command line from the DOS prompt:
QB /L ieeeqb.qlb
The above command line will load QuickBASIC and the
user library.
' Press any key to end program
' Read input port
' Check integrity of read operation
' Display status and state of input
' port END
' Print error message and stop
' program if the read operation is
' corrupt (1)

Advertisement

Table of Contents
loading

Table of Contents