Example Programs E-7
Controlling the Model 6514 via the RS-232 COM2 port
This example program illustrates the use of the Keithley Model 6514 interfaced to the RS-232
COM2 port. The Model 6514 is set up to take 100 readings at the fastest possible rate. The read-
ings are taken, sent across the serial port, and displayed on the screen.
' Example program controlling the Model 6514 via the RS-232 COM2 port
' For QuickBASIC 4.5 and CEC PC488 interface card
RD$=SPACE$(1500) ' Set string space
CLS ' CLear screen
PRINT "Set COM2 baud rate to 19200"
PRINT "Set 8 data bits, no parity, no flow control, and CR as Termina-
tor"
' Configure serial port parameters
ComOpen$="COM2:19200,N,8,1,ASC,CD0,CS0,DS0,LF,OP0,RS,TB8192,RB8192"
OPEN ComOpen$ FOR RANDOM AS #1
' Model 6514 setup commands
' Note Serial communications only operate with SCPI mode....
PRINT #1, “*RST” ‘ RST defaults
PRINT #1, “*CLS” ‘ Clear registers
PRINT #1, “VOLT:RANG 10” ‘ 10V range
PRINT #1, “SYST:AZER OFF” ‘ Disable autozero
PRINT #1, “AVER OFF” ‘ Disable average filter
PRINT #1, “DISP:DIG 4” ‘ 3½-digit resolution
PRINT #1, “FORM:ELEM READ” ‘ Reading only
PRINT #1, “VOLT:NPLC 0.01” ‘ NPLC = 0.01
PRINT #1, “TRIG:COUN 100” ‘ 100 readings
PRINT #1, “DISP:ENAB OFF” ‘ Turn off display
PRINT #1, “INIT” ‘ Take 6514 out of idle
SLEEP 1 ‘ Wait one second
PRINT #1, “READ?” ‘ Perform measurements
LINE INPUT #1, RD$ ‘ Get data
PRINT RD$ ‘ Display data on CRT
PRINT #1, “DISP:ENAB ON” ‘ Turn on display
PRINT #1, “SYST:AZER ON” ‘ Enable autozero
‘ Clean up and quit:
CLOSE #1 ‘ Close file
CLEAR ‘ Clear interface
END