示例#1
0
文件: gpib.py 项目: herm/pyvisa-py
    def get_low_level_info(cls):
        try:
            ver = gpib.version()
        except AttributeError:
            ver = '< 4.0'

        return 'via Linux GPIB (%s)' % ver
示例#2
0
    def get_low_level_info(cls):
        try:
            ver = gpib.version()
        except AttributeError:
            ver = '< 4.0'

        return 'via Linux GPIB (%s)' % ver
示例#3
0
    async def version(self):
        """
        Get the GPIB library version. Not implemented on Windows.

        Returns
        -------
        str
             GPIB library version
        """
        return gpib.version().decode("utf-8")
示例#4
0
    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 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