public void FillRequest(byte[] request, int offset)
        {
            FillResponse(request, offset, null);
            var bytes = ModbusHelper.EncodeWords(values);

            request[offset + 6] = (byte)bytes.Length;
            ModbusHelper.Copy(bytes, 0, request, offset + 7, bytes.Length);
        }
Exemple #2
0
        public void FillResponse(byte[] response, int offset, object value)
        {
            var bytes = ModbusHelper.BytesForBools(count);

            response[offset + 0] = slave;
            response[offset + 1] = 1;
            response[offset + 2] = bytes;
            var data = ModbusHelper.EncodeBools((bool[])value);

            ModbusHelper.Copy(data, 0, response, offset + 3, bytes);
        }
Exemple #3
0
        public void FillResponse(byte[] response, int offset, object value)
        {
            var bytes = ModbusHelper.BytesForWords(count);

            response[offset + 0] = slave;
            response[offset + 1] = 4;
            response[offset + 2] = bytes;
            var data = ModbusHelper.EncodeWords(value as ushort[]);

            ModbusHelper.Copy(data, 0, response, offset + 3, bytes);
        }