GPIB reference for Keithley 2001/2002

Common GPIB commands:

Command mnemonic Name Description
*CLS Clear status Clears all event registers, and Error Queue
*ESE Event Enable command Program the Standard Event Enable Register
*ESE? Event Enable query Read the Standard Event Enable Register
*ESR? Event status register query Read the Standard Event Status Register and clear it
*IDN? Identification query Returns the manufacturer, model number, serial number, and firmware revision levels of the unit
*OPC Operation complete command Sets the Operation Complete bit in the Standard Event Status Register after all pending commands have been executed
*OPC? Operation complete query Places an ASCII “1” into the output queue when all pending selected device operations have been completed
*OPT? Option identification query Returns an ID code that indicates which memory option is installed and whether or not the optional scanner card is installed
*RCL Recall command Returns the Model 2002 to the setup configuration stored in the specified memory location
*RST Reset command Returns the Model 2002 to the *RST default conditions
*SAV Save command Saves the current setup to the specified memory location
*SRE Service request enable command Programs the Service Request Enable Register
*SRE? Service request enable query Reads the Service Request Enable Register
*STB? Read status byte query Reads the Status Byte Register
*TRG Trigger command Sends a bus trigger to the 2002
*TST? Self-test query Performs a checksum test on ROM and returns the result
*WAI Wait-to-continue command Wait until all previous commands are executed

Print data on screen

:DISP:WIND:TEXT:DATA " ";STAT ON;

Second line:

:DISP:WIND1:TEXT:DATA " ";STAT ON;
:SYST:AZER:TYPE SYNC;
:SYST:LSYN:STAT ON;
:SENSE:FUNC 'FRES';
:SENS:FRES:RANG 20000;
:SENS:FRES:NPLC 10;
:SENS:FRES:DIG 8.5;
:SENS:FRES:AVER:COUN 3;
:SENS:FRES:AVER:STAT ON;
:TRIG:SEQ:SOUR TIM;
:TRIG:SEQ:DEL 0.01;
:READ?
:SYST:AZER:TYPE SYNC;
:SYST:LSYN:STAT ON;
:SENSE:FUNC 'VOLT:DC';
:SENS:VOLT:DC:NPLC 10;
:SENS:VOLT:DC:DIG 8.5;
:SENS:VOLT:DC:AVER:COUN 3;
:SENS:VOLT:DC:AVER:STAT OFF;
:TRIG:SEQ:SOUR TIM;
:TRIG:SEQ:DEL 0.01;
:READ?
:SYST:AZER:TYPE SYNC;
:SYST:LSYN:STAT ON;
:SENSE:FUNC 'VOLT:DC';
:SENS:VOLT:DC:NPLC 1;
:SENS:VOLT:DC:DIG 8.5;
:SENS:VOLT:DC:AVER:COUN 3;
:SENS:VOLT:DC:AVER:STAT OFF;
:TRIG:SEQ:SOUR TIM;
:TRIG:SEQ:DEL 0.01;
:READ?

Python application to capture DCV samples, with 8.5-digit resolution, 20VDC range and 10NPLC speed.

# xDevs.com Python test GPIB app 
# https://xdevs.com/guide/gpib-kei/
import sys
import Gpib
import time

kei = Gpib.Gpib(0,16, timeout=30) # K2001 GPIB Address = 16, Timeout 30 seconds
kei.clear()

# Setup Keithley 2001
kei.write("*RST")
kei.write("*CLR")
kei.write(":SYST:AZER:TYPE SYNC")
kei.write(":SYST:LSYN:STAT ON")
kei.write(":SENS:FUNC 'VOLT:DC'")
kei.write(":SENS:VOLT:DC:DIG 9; NPLC 10; AVER:COUN 5; TCON REP")
kei.write(":SENS:VOLT:DC:AVER:STAT ON")
kei.write(":SENS:VOLT:DC:RANG 20")
kei.write(":FORM:ELEM READ")
kei.write(":DISP:WIND:TEXT:DATA \"               \";STAT ON;")
kei.write(":DISP:WIND2:TEXT:DATA \"               \";STAT ON;")

klevel = 10.0000000
i = 0

while i <= 10000000:
    i+=1
    with open('datalog.csv', 'a') as o:
        time.sleep(1)
        kei.write("READ?")
        keival = kei.read()
        kppm = ((float(keival) / klevel)-1)*1E6
        kei.write(":DISP:WIND2:TEXT:DATA \"  %8.4f ppm\";STAT ON;" % float(kppm))
	khp = (((float(data) / float(keival))-1)*1E6)
	print time.strftime("%d/%m/%Y-%H:%M:%S;") + ("[%8d]: %2.8f , dev %4.4f ppm, K:%2.8f, dev %4.4f ppm, TEMP:%3.1f, K/H %4.2f" % (min, float(data),float(ppm),float(keival),float(kppm),float(temp),float(khp) ) )
        o.write (time.strftime("%d/%m/%Y-%H:%M:%S;") + ("%16.8f;%16.8f;%16.8f;%3.1f;%4.3f;%4.3f\r\n" % (float(data),float(level),float(keival),float(temp),float(ppm),float(kppm) ) ))
        o.close()

p.

Displaying The Windows of the 2001

Under normal usage of the 2001, a user would use the :SENSE:DATA? to return a reading from the 2001. Using this command only returns the data in the primary window. It does not return the units nor does it return any of the information from the secondary display. If a programmer chooses to return the data from the secondary window, he or she would have to program the 2001 to measure the very specific paramters. For example, if the 2001 is set for DC volts and the next button was pushed, the display may look as follows:

+064.8283  mVDC
+000.405  mVAC           +060.15      Hz

In this case, only the value +64.8283E-03 would be returned to the computer.

To return the entire display, the command :DISPLAY:WINDOW1:DATA? is sent to the 2001 to return the first window display and :DISPLAY:WINDOW2:DATA? is sent to return the second window display. As shown in the example program below, both windows can be returned:

If meter_enabled Then
    cmd$=":DISPLAY:WINDOW1:DATA?"
    Call Send(GPIBAddress,cmd$,status%)
    If status% = 0 Then
	Call Enter(disp1$, 21, l%, GPIBAddress, status%)
	If status% = 0 Then
	    cmd$=":DISPLAY:WINDOW2:DATA?"
	    Call Send(GPIBAddress,cmd$,status%)
	    If status% = 0 Then
		Call Enter(disp2$, 33, l%, GPIBAddress, status%)
		If status% = 0 Then
		    Print disp1$
		    Print disp2$
		End If
	    End If
	End If
    End If
End if

Please note in each Call Enter commands the values 21 and 33. The top window of the 2001 can display 20 characters and the bottom window can display 32 characters. When the window string is returned to the host computer, all 20 and 32 characters are returned along with an additional line feed (LF) character. Thus, to properly transfer the entire window string, 21 and 33 characters must be returned, otherwise, an error condition will occur. When both window strings have been transferred, the information can be displayed on the CRT or an application program can separately parse the information for the numerical data only for future use.

© John Tucker 5/1/92

Working with scan cards:

Python example for Keithley 2001/2002 with 2001-TCSCAN

Author: Ilya Tsemenko
Created: Jan. 4, 2015, 4 p.m.
Modified: July 6, 2016, 2:23 a.m.

References