i tested that
var
b,bb: byte;
buf: pchar;
b16: word;
begin
if len = 3 then begin
b16 := (buf[0]) + (buf[1]) + 256 ;
result := IntToStr(b16) ;
end;
end;
there is error message "Error: Element zero of an ansi/wide- or longstring can't be accessed, use (set)length instead"
then i tested this code
var
b,bb: byte;
buf: pchar;
b16: word;
if len = 3 then begin
b16 := ord(buf[0]) + ord(buf[1]) + ord(buf[2]) + 256;
result := IntToStr(b16);
end;
then result is 569 when plc send 65499
i check
buf[0] = 219
buf[1]= 62
buf[2]= 32