|
104 | 104 | CMD_BUS_STATUS_LISTENER = 7 |
105 | 105 | CMD_BUS_STATUS_BUS_ADDRESS = 8 |
106 | 106 |
|
| 107 | +GPIB_CMD_GTL = 0x01 # go to local |
| 108 | +GPIB_CMD_SDC = 0x04 # selected device clear |
| 109 | +GPIB_CMD_PPC = 0x05 # parallel poll config |
| 110 | +GPIB_CMD_GET = 0x08 # group execute trigger |
| 111 | +GPIB_CMD_TCT = 0x09 # take control |
| 112 | +GPIB_CMD_LLO = 0x11 # local lockout |
| 113 | +GPIB_CMD_DCL = 0x14 # device clear |
| 114 | +GPIB_CMD_PPU = 0x15 # parallel poll unconfigure |
| 115 | +GPIB_CMD_SPE = 0x18 # serial poll enable |
| 116 | +GPIB_CMD_SPD = 0x19 # serial poll disable |
| 117 | +GPIB_CMD_LAD = 0x20 # listen address (base) |
| 118 | +GPIB_CMD_UNL = 0x3F # unlisten |
| 119 | +GPIB_CMD_TAD = 0x40 # talk address (base) |
| 120 | +GPIB_CMD_UNT = 0x5F # untalk |
| 121 | +GPIB_CMD_SAD = 0x60 # my secondary address (base) |
| 122 | +GPIB_CMD_PPE = 0x60 # parallel poll enable (base) |
| 123 | +GPIB_CMD_PPD = 0x70 # parallel poll disable |
| 124 | + |
107 | 125 | def parse_visa_resource_string(resource_string): |
108 | 126 | # valid resource strings: |
109 | 127 | # TCPIP::10.0.0.1::INSTR |
@@ -805,6 +823,29 @@ def send_command(self, data): |
805 | 823 |
|
806 | 824 | return data_out |
807 | 825 |
|
| 826 | + def create_setup(self, address_list): |
| 827 | + data = bytearray([self._bus_address | GPIB_CMD_TAD, GPIB_CMD_UNL]) |
| 828 | + |
| 829 | + for addr in address_list: |
| 830 | + if type(addr) == tuple: |
| 831 | + if addr[0] < 0 or addr[0] > 30: |
| 832 | + raise Vxi11Exception("Invalid address", 'create_setup') |
| 833 | + data.append(addr[0] | GPIB_CMD_LAD) |
| 834 | + if len(addr) > 1: |
| 835 | + if addr[1] < 0 or addr[1] > 30: |
| 836 | + raise Vxi11Exception("Invalid address", 'create_setup') |
| 837 | + data.append(addr[1] | GPIB_CMD_SAD) |
| 838 | + else: |
| 839 | + if addr < 0 or addr > 30: |
| 840 | + raise Vxi11Exception("Invalid address", 'create_setup') |
| 841 | + data.append(addr | GPIB_CMD_LAD) |
| 842 | + |
| 843 | + return bytes(data) |
| 844 | + |
| 845 | + def send_setup(self, address_list): |
| 846 | + "Send setup" |
| 847 | + return self.send_command(self.create_setup(address_list)) |
| 848 | + |
808 | 849 | def _bus_status(self, val): |
809 | 850 | "Bus status" |
810 | 851 | if self.link is None: |
|
0 commit comments