Welcome, Guest
Username: Password: Remember me
Components and Libraries for HMI/SCADA applications, discussions, problems and suggestions
  • Page:
  • 1

TOPIC:

Bug found and fixed on ModbusTCP.pas 5 years 5 months ago #12745

  • Marco Pinero
  • Marco Pinero's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 13
  • Thank you received: 0
Hi all.

I got this bug at modbustcp.pas from pl_PascalScada:

At line 410 Codetyphon has this code:
       // data are ok
        for i:=0 to Len-1 do begin
          if (10+i*20)<Length(pkg.BufferToRead) then
            Values[i]:=(LongInt(pkg.BufferToRead[9+(i*2)]) shl 8) + LongInt(pkg.BufferToRead[10+i*2])
          else
            Values[i]:=0
        end;
I solved it doing this:
   // data are ok
        for i:=0 to Len-1 do begin
          if (10+i*2)<Length(pkg.BufferToRead) then  (*<---- it is not I*20 (it is jumping 20 bytes and that's not correct) it must be I*2) *)
            Values[i]:=(LongInt(pkg.BufferToRead[9+(i*2)]) shl 8) + LongInt(pkg.BufferToRead[10+i*2])
          else
            Values[i]:=0
        end;


That's all!!!...

Please Log in or Create an account to join the conversation.

Last edit: by Marco Pinero. Reason: Bad text indentation

Bug found and fixed on ModbusTCP.pas 5 years 5 months ago #12746

  • Fabio Luis Girardi
  • Fabio Luis Girardi's Avatar
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 30
  • Thank you received: 13
I already have fixed this in Pascalscada repository, some days ago.

Thanks by your feedback!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: Curt