Menu

Modbus16 CRC

Anonymous
2019-02-27
2019-02-28
  • Anonymous

    Anonymous - 2019-02-27

    Sending sequence 01 10 00 00 00 01 02 80 00 as HEX, RealTerm (3.0.1.44) appends the wrong CRC DB 50 instead of the correct C7 90.
    The problem arises whenever there is 80 (128 decimal) in the sequence.
    By sending 80, the wrong CRC is BF 3D instead of BE E0.
    By sending FF FF 80, the wrong CRC is 00 7D instead of 01 A0.
    (Note: the generator polynimony is in fact A001 and this is the correct value for position 128 of the calculation table).
    Thank you!
    Roberto A.

     
  • Simon Bridger

    Simon Bridger - 2019-02-28

    Can you make a bug ticket please, then I can get you to test it when fixed. (you need to make SF id)

    It looks like the generator is A001:

      crc := $FFFF;
      for i := 1 to length(msg) do
      begin
        b := ord(msg[i]);
        crc := crc xor b;
        for n := 1 to 8 do
        begin
          if (crc and 1) <> 0 then
            crc := (crc shr 1) xor $A001
          else
            crc := crc shr 1;
        end;
      end;
    
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB