def _SetInputRegistersOverlay(self, addr, qty, data):
        """Same as SetInputRegisters, except for register overlay option.
		The discrete inputs appear to be packed into input registers 0 to 4095.
		"""
        if addr > 4095:
            self._SetInputRegisters(addr, qty, data)
        else:
            binstr = ModbusDataLib.swapbytes(data)
            self._DiscInputs[addr * 16 : (addr + qty) * 16] = ModbusDataLib.bin2boollist(binstr)[: qty * 16]
    def _GetInputRegistersOverlay(self, addr, qty):
        """Same as GetInputRegisters, except for register overlay option.
		The discrete inputs appear to be packed into input registers 0 to 4095.
		"""
        if addr > 4095:
            return self._GetInputRegisters(addr, qty)
        else:
            binstr = ModbusDataLib.boollist2bin(self._DiscInputs[addr * 16 : (addr + qty) * 16])
            return ModbusDataLib.swapbytes(binstr)
    def _SetHoldingRegistersOverlay(self, addr, qty, data):
        """Same as SetHoldingRegisters, except for register overlay option.
		The coils appear to be packed into holding registers 0 to 4095.
		"""
        if addr > 4095:
            self._SetHoldingRegisters(addr, qty, data)
        else:
            binstr = ModbusDataLib.swapbytes(data)
            self._Coils[addr * 16 : (addr + qty) * 16] = ModbusDataLib.bin2boollist(binstr)[: qty * 16]
    def _GetHoldingRegistersOverlay(self, addr, qty):
        """Same as GetHoldingRegisters, except for register overlay option.
		The coils appear to be packed into holding registers 0 to 4095.
		"""
        if addr > 4095:
            return self._GetHoldingRegisters(addr, qty)
        else:
            binstr = ModbusDataLib.boollist2bin(self._Coils[addr * 16 : (addr + qty) * 16])
            return ModbusDataLib.swapbytes(binstr)
Пример #5
0
    def _GetInputRegistersOverlay(self, addr, qty):
        """Same as GetInputRegisters, except for register overlay option.
		The discrete inputs appear to be packed into input registers 0 to 4095.
		"""
        if (addr > 4095):
            return self._GetInputRegisters(addr, qty)
        else:
            binstr = ModbusDataLib.boollist2bin(
                self._DiscInputs[addr * 16:(addr + qty) * 16])
            return ModbusDataLib.swapbytes(binstr)
Пример #6
0
    def _SetHoldingRegistersOverlay(self, addr, qty, data):
        """Same as SetHoldingRegisters, except for register overlay option.
		The coils appear to be packed into holding registers 0 to 4095.
		"""
        if (addr > 4095):
            self._SetHoldingRegisters(addr, qty, data)
        else:
            binstr = ModbusDataLib.swapbytes(data)
            self._Coils[addr * 16:(addr + qty) *
                        16] = ModbusDataLib.bin2boollist(binstr)[:qty * 16]
Пример #7
0
    def _GetHoldingRegistersOverlay(self, addr, qty):
        """Same as GetHoldingRegisters, except for register overlay option.
		The coils appear to be packed into holding registers 0 to 4095.
		"""
        if (addr > 4095):
            return self._GetHoldingRegisters(addr, qty)
        else:
            binstr = ModbusDataLib.boollist2bin(
                self._Coils[addr * 16:(addr + qty) * 16])
            return ModbusDataLib.swapbytes(binstr)
Пример #8
0
    def _SetInputRegistersOverlay(self, addr, qty, data):
        """Same as SetInputRegisters, except for register overlay option.
		The discrete inputs appear to be packed into input registers 0 to 4095.
		"""
        if (addr > 4095):
            self._SetInputRegisters(addr, qty, data)
        else:
            binstr = ModbusDataLib.swapbytes(data)
            self._DiscInputs[addr * 16:(addr + qty) *
                             16] = ModbusDataLib.bin2boollist(binstr)[:qty *
                                                                      16]