coassoftwaresystems / delphi-modbus

Delphi ModbusTCP components
MIT License
119 stars 64 forks source link

ModBusMaster Demo reads values fine but gives an error when writing values #46

Open AdamRoslon opened 4 years ago

AdamRoslon commented 4 years ago

I'm able to read register values without any problem, but I'm not able to write to the register values.

mctPLC.WriteRegister is returning False because TIdModBusClient.SendCommand is returning False

IOHandler.ReadBytes(RecBuffer, iSize); is setting ReceiveBuffer.FunctionCode to 134 but it needs to be equal to AModBusFunction which is 6

I get the same result with the compiled demos as I do when I compile them myself.

2020-11-14_102532