You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I have converted your Delphi Slave demo (Indy10) to Lazarus (Version 2.2.0 64bit on Windows 10).
I am sending 32-bit values from PLC to TIdModBusServer by using 16-PresetMultipleRegisters method.
For the sake of debugging, I have modified the code of your demo as follows (added logging to mmoErrorLog):
procedure TfrmMain.msrPLCWriteRegisters(const Sender: TIdContext;
const RegNr, Count: integer; const Data: TModRegisterData;
const RequestBuffer: TModBusRequestBuffer; var ErrorCode: byte);
var
i: integer;
begin
mmoErrorLog.Lines.Add('Message register = ' + IntToStr(RegNr) +
'; Message length= ' + IntToStr(Count));
for i := 0 to (Count - 1) do
begin
SetRegisterValue(RegNr + i, Data[i]);
mmoErrorLog.Lines.Add('Message value ' + IntToStr(i) + ' = ' + IntToStr(Data[i]));
end;
end;
I sent the values 3 and 7993, and this is what I get in the ErrorLog:
Message register = 11; Message length= 2
Message value 0 = 3
Message value 1 = 7993
Message register = 11; Message length= 2
Message value 0 = 0
Message value 1 = 7993
As you can see, the event gets triggered twice, where the second one contains a wrong value (0 instead of 3).
Any solution to this problem?
The text was updated successfully, but these errors were encountered:
Hi Jens,
you may close the issue - the PLC is sending weird data.
I apologize for the inconvenience.
To explain - the PLC is sending data even if the output registers are not ready, so it is sending "something" that is in the register at the moment. The second problem is the repetition of sending - the PLC sends the Modbus message 1-3 times in one shot, and it happens that the registers do not contain valid data for every repetition.
Hi,
I have converted your Delphi Slave demo (Indy10) to Lazarus (Version 2.2.0 64bit on Windows 10).
I am sending 32-bit values from PLC to TIdModBusServer by using 16-PresetMultipleRegisters method.
For the sake of debugging, I have modified the code of your demo as follows (added logging to mmoErrorLog):
I sent the values 3 and 7993, and this is what I get in the ErrorLog:
As you can see, the event gets triggered twice, where the second one contains a wrong value (0 instead of 3).
Any solution to this problem?
The text was updated successfully, but these errors were encountered: