DECLARE SUB gpibclrdev (addr$) DECLARE SUB gpibin (addr$, msg$) DECLARE SUB gpibout (addr$, cmd$) DECLARE SUB gpibterm (termin$, termout$) '**************************************************************************** 'Module K7011 'This module contains subroutines which control the Keithley 7011 'multiplexer. ' 'Zachary Wolf '6/8/94, 10/25/96 '**************************************************************************** 'Common area for shared parameters COMMON SHARED /k7011/ gpibinP%, gpiboutP%, k7011addrP$ 'Semi-permanent parameters CONST terminP$ = "LF EOI" 'GPIB input terminator CONST termoutP$ = "LF EOI" 'GPIB output terminator SUB k7011closecc (card%, chan%) '**************************************************************************** 'This subroutine closes one channel of the Keithley 7011 multiplexer. ' 'Input: ' card%, the card number, 1 or 2 ' chan%, the channel number, 1 to 40 ' 'Zachary Wolf '6/6/94, 10/25/96 '**************************************************************************** 'Set the GPIB terminators CALL gpibterm(terminP$, termoutP$) 'Check IF card% < 1 OR card% > 2 OR chan% < 1 OR chan% > 40 THEN PRINT : PRINT "k7011closecc: Problem with the Keithley 7011 input." STOP END IF 'Close the desired channel list$ = "(@" + LTRIM$(STR$(card%)) + "!" + LTRIM$(STR$(chan%)) + ")" CALL gpibout(k7011addrP$, ":CLOSE " + list$) 'Wait the specified time for the switch to close tstep! = TIMER WHILE TIMER - tstep! < .2 WEND END SUB SUB k7011init '**************************************************************************** 'This subroutine initializes the Keithley 7011 multiplexer card in the 'model 7001 chassis. ' 'Zachary Wolf '6/6/94, 10/25/96 '**************************************************************************** 'Set the GPIB terminators CALL gpibterm(terminP$, termoutP$) 'Message PRINT PRINT "Resetting the Keithley 7011..." 'Clear the K7011 CALL gpibclrdev(k7011addrP$) 'Reset the 7011 CALL gpibout(k7011addrP$, "*RST") 'Clear the error registers CALL gpibout(k7011addrP$, "*CLS") 'Make sure all channels are open CALL gpibout(k7011addrP$, ":OPEN ALL") 'Display the ID CALL gpibout(k7011addrP$, "*IDN?") CALL gpibin(k7011addrP$, id$) PRINT id$ END SUB SUB k7011openall '**************************************************************************** 'This subroutine opens all the channels of the Keithley 7011 multiplexer. ' 'Zachary Wolf '6/6/94, 10/25/96 '**************************************************************************** 'Set the GPIB terminators CALL gpibterm(terminP$, termoutP$) 'Open all channels CALL gpibout(k7011addrP$, ":OPEN ALL") END SUB SUB k7011setpar (gpibinf%, gpiboutf%, k7011addr$) '**************************************************************************** 'This subroutine initializes the Keithley 7011 multiplexer. ' 'Input: ' gpibinf%, gpib input file number ' gpiboutf%, gpib output file number ' k7011addr$, gpib address in a string ' 'Zachary Wolf '4/19/94, 5/19/95, 10/25/96 '**************************************************************************** 'Make sure the input parameters have reasonable values IF gpibinf% < 0 OR gpibinf% > 100 THEN PRINT "K7011: GPIB problem" EXIT SUB END IF IF gpiboutf% < 0 OR gpiboutf% > 100 THEN PRINT "K7011: GPIB problem" EXIT SUB END IF IF k7011addr$ = "" THEN PRINT "K7011: GPIB problem" EXIT SUB END IF 'Save the GPIB information in a common block for future use gpibinP% = gpibinf% gpiboutP% = gpiboutf% k7011addrP$ = k7011addr$ END SUB