예제 #1
0
    def GetDiscreteInputs(self, addr, qty):
        """Return qty discrete input values as a packed binary string. 
		If qty is not a multiple of 8, the remainder of the string will 
		be padded with zeros.
		addr (integer) - Discrete input address.
		qty (integer) - Number of discrete inputs desired.
		Returns a packed binary string.
		"""
        return ModbusDataLib.boollist2bin(self._DiscInputs[addr:addr + qty])
예제 #2
0
    def GetCoils(self, addr, qty):
        """Return qty coil values as a packed binary string. 
		If qty is not a multiple of 8, the remainder of the string will 
		be padded with zeros.
		addr (integer) - Coil address.
		qty (integer) - Number of coils desired.
		Returns a packed binary string.
		"""
        return ModbusDataLib.boollist2bin(self._Coils[addr:addr + qty])
    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 _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)
    def GetDiscreteInputs(self, addr, qty):
        """Return qty discrete input values as a packed binary string. 
		If qty is not a multiple of 8, the remainder of the string will 
		be padded with zeros.
		addr (integer) - Discrete input address.
		qty (integer) - Number of discrete inputs desired.
		Returns a packed binary string.
		"""
        return ModbusDataLib.boollist2bin(self._DiscInputs[addr : addr + qty])
    def GetCoils(self, addr, qty):
        """Return qty coil values as a packed binary string. 
		If qty is not a multiple of 8, the remainder of the string will 
		be padded with zeros.
		addr (integer) - Coil address.
		qty (integer) - Number of coils desired.
		Returns a packed binary string.
		"""
        return ModbusDataLib.boollist2bin(self._Coils[addr : addr + qty])
예제 #7
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)
예제 #8
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)