public void FillRequest(byte[] request, int offset) { request[offset + 0] = slave; request[offset + 1] = 5; request[offset + 2] = ModbusHelper.High(address); request[offset + 3] = ModbusHelper.Low(address); request[offset + 4] = ModbusHelper.EncodeBool(value); request[offset + 5] = 0; }
public void FillRequest(byte[] request, int offset) { request[offset + 0] = slave; request[offset + 1] = 1; request[offset + 2] = ModbusHelper.High(address); request[offset + 3] = ModbusHelper.Low(address); request[offset + 4] = ModbusHelper.High(count); request[offset + 5] = ModbusHelper.Low(count); }
public void FillResponse(byte[] response, int offset, object value) { response[offset + 0] = slave; response[offset + 1] = 16; response[offset + 2] = ModbusHelper.High(address); response[offset + 3] = ModbusHelper.Low(address); response[offset + 4] = ModbusHelper.High(values.Length); response[offset + 5] = ModbusHelper.Low(values.Length); }
public void FillResponse(byte[] response, int offset, object value) { response[offset + 0] = ModbusHelper.High(transactionId); response[offset + 1] = ModbusHelper.Low(transactionId); response[offset + 2] = 0; response[offset + 3] = 0; response[offset + 4] = ModbusHelper.High(wrapped.ResponseLength); response[offset + 5] = ModbusHelper.Low(wrapped.ResponseLength); wrapped.FillResponse(response, offset + 6, value); }
public void FillRequest(byte[] request, int offset) { request[offset + 0] = ModbusHelper.High(transactionId); request[offset + 1] = ModbusHelper.Low(transactionId); request[offset + 2] = 0; request[offset + 3] = 0; request[offset + 4] = ModbusHelper.High(wrapped.RequestLength); request[offset + 5] = ModbusHelper.Low(wrapped.RequestLength); wrapped.FillRequest(request, offset + 6); }
public byte[] GetException(byte code) { var exception = new byte[5]; exception[0] = wrapped.Slave; exception[1] = (byte)(wrapped.Code | 0x80); exception[2] = code; var crc = ModbusHelper.CRC16(exception, 0, 3); exception[3] = ModbusHelper.Low(crc); exception[4] = ModbusHelper.High(crc); return(exception); }
public byte[] GetException(byte code) { var exception = new byte[9]; exception[0] = ModbusHelper.High(transactionId); exception[1] = ModbusHelper.Low(transactionId); exception[2] = 0; exception[3] = 0; exception[4] = ModbusHelper.High(3); exception[5] = ModbusHelper.Low(3); exception[6 + 0] = wrapped.Slave; exception[6 + 1] = (byte)(wrapped.Code | 0x80); exception[6 + 2] = code; return(exception); }