String with Hex Codes Problem with Charset TComPort

I'm using Delphi 10.3 Community Edition and Add TComPort, but my problem is that when I'm sending 9E I see 17E

 msg : String;


 msg := #$40+#$03+#$00+#$00+#$00+#$00+#$00+#$00+#$00+#$00+#$9E+#$E1+#$0A;
 SendFPMessage(msg);

 procedure TForm1.SendFPMessage(s: String);
 begin
    Comport1.WriteStr(s);
    Memo1.Lines.Add('SND:['+trim(String2Hex(s))+']');
 end;

I'm verifing the communcation with Serial Port Monitor

  My Programm: SND:[40 03 00 00 00 00 00 00 00 00 17E E1 0A]
  SPM: 40 03 00 00 00 00 00 00 00 00 7e e1 0a            @.........~á.   

I tryied AnsiString (28591) and UTF8String and created new collateral damage.

Upvotes: 1

Views: 281

Answers (1)

I don't if I found the best option: Changed #$9E to char(158)

Upvotes: 0

Related Questions