def __init__(self, device):
        """ Initializes the ITC class. It depends on an visa device

            Arguments:
            device -- (visa.instrument) a GPIB instrument is required
        """
        self.__lcr = device
        self.__lcr.term_chars = '\r'
        # needed for error free communication
        gpib.config(self.__lcr.device, gpib.IbcEOSchar, ord('\r'))
        # use REOS und XEOS
        gpib.config(self.__lcr.device, gpib.IbcEOSrd, 0x800 | 0x400)


        # Setup the device to work as needed for the following functions
        self.clear() # Clears the GPIB Bus to prevent problems in communication.
        self.__lcr.write("FORM ASCII") # Set data output format to ASCii
        self.__lcr.write("TRIG:SOUR BUS") # Set trigger to listen only on gpib-bus
        self.__lcr.write("INIT:CONT ON") # Set the system to continuously wait for the next trigger


        # Load a list of allowed frequency vaules for the device
        self.__frequency_list = np.loadtxt('HP4284A_LCRMeter_frequency_table.par')

        # Set a list of all possible meaurement settings
        self.__measurement_ident_list = ['CPD', 'CPQ', 'CPG', 'CPRP', 'CSD', 'CSQ', 'CSRS','LPQ', 'LPD', 'LPG',
                                        'LPRP', 'LSD','LSQ', 'LSRS', 'RX', 'ZTD', 'ZTR', 'GB', 'YTD', 'YTR']

        # Set variables important for the state of the instrument
        self.high_power_mode = False
        self.__num_averages = 1 # Has to be preset, because the number averages and the integration time use one LCR-command
        self.__integration_time = 'MED'
Example #2
0
    def __init__(self, device):
        """ Initializes the ILM class. It depends on an visa device

            Arguments:
            device -- (visa.instrument) a GPIB instrument is required
        """
        self.ilm = device
        self.ilm.term_chars = '\r'
        gpib.config(self.ilm.device, gpib.IbcEOSchar, ord('\r'))
        # use REOS und XEOS
        gpib.config(self.ilm.device, gpib.IbcEOSrd, 0x800 | 0x400)
Example #3
0
    def __init__(self, device):
        """ Initializes the ITC class. It depends on an visa device

            Arguments:
            device -- (visa.instrument) a GPIB instrument is required
        """
        self.itc = device
        self.itc.term_chars = '\r'
        # needed for error free communication
        gpib.config(self.itc.device, gpib.IbcEOSchar, ord('\r'))
        # use REOS und XEOS
        gpib.config(self.itc.device, gpib.IbcEOSrd, 0x800 | 0x400)
Example #4
0
    def __init__(self, address: int = 25):
        assert (1 <= address <= 32), 'address out of range'

        self._device_handler = gpib.dev(0, address)
        gpib.config(self._device_handler, gpib.IbaEOSrd, 1)
        gpib.config(self._device_handler, gpib.IbaEOSchar, 13)
Example #5
0

def initialise_device(handle):  # set up device to assert SRQ/RQS
    gpib.write(handle, "*CLS")  # Clear status registers
    gpib.write(handle, "*SRE 32")  # Assert SRQ on Event
    return


def show_devid(handle):  # Show device ID
    print query(handle, "*IDN?")
    return


print gpib.version()  # Show package version
ud = gpib.dev(board, device)  # Open the device
gpib.config(board, gpib.IbcAUTOPOLL, 1)  # Enable automatic serial polling
gpib.config(ud, gpib.IbcTMO, gpib.T30s)  # Set timeout to 30 seconds
show_devid(ud)
initialise_device(ud)
gpib.write(handle, "*TST;*OPC")  # Selftest and request OPC event
# Wait for Timeout or Request Service on device
sta = gpib.wait(ud, gpib.TIMO | gpib.RQS)
if (sta & gpib.TIMO) != 0:
    print "Timed out"
else:
    print "Device asserted RQS"
    stb = gpib.serial_poll(ud)  # Read status byte
    print "stb = %#x" % (stb)
    if (stb & gpib.IbStbESB) != 0:  # Check for Event Status bit
        esr = int(query(ud, "ESR?"))  # Read Event Status Register
        if (esr & 1) != 0:  # Check for operation completed
Example #6
0
        response = gpib.read(handle,numbytes)
        response = response.rstrip("\r\n")
        return response

def initialise_device(handle):            # set up device to assert SRQ/RQS
        gpib.write(handle,"*CLS")         # Clear status registers
        gpib.write(handle,"*SRE 32")      # Assert SRQ on OPC
        return

def show_devid(handle):                   # Show device ID
        print query(handle,"*IDN?")      
        return

print gpib.version()                      # Show package version
ud = gpib.dev(board,device)               # Open the device
gpib.config(board,gpib.IbcTMO, gpib.T30s) # Set timeout to 30 seconds
show_devid(ud);
initialise_device(ud);
gpib.write(handle,"*TST;*OPC")            # Initiate selftest and request OPC
# Wait for Timeout or Service Request on board
sta = gpib.wait(board, gpib.TIMO | gpib.SRQI)
if (sta & gpib.TIMO) != 0:
   print "Timed out"
else:
  print "SRQ asserted "
# For each device which might pull SRQ
  stb = gpib.serial_poll(ud)            # Read status byte
  print "stb = %#x"%(stb)
  if (stb & gpib.IbStbRQS) != 0:        # Check for RQS bit
    print "Device asserted RQS"
    if (stb & gpib.IbStbESB) != 0:      # Check for Event Status bit
Example #7
0
 def config(self, option, value):
     self.res = gpib.config(self.id, option, value)
     return self.res
	def config(self, option, value):
		self.res = gpib.config(self.id, option, value)
		return self.res