Exemplo n.º 1
0
 def wait(self,mask):
     gpib.wait(self.id,mask)
Exemplo n.º 2
0
        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
            esr = int(query(ud,"ESR?")) # Read Event Status Register
            if (esr & 1) != 0:          # Check for operation completed
                    print "Device Operation Completed"

# done  
Exemplo n.º 3
0
    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
            print "Device Operation Completed"

# done
gpib.close(ud)
Exemplo n.º 4
0
 def wait(self, mask):
     gpib.wait(self.id, mask)