Hello,
thanks for your reply
I did it and situation looks better.
But something still happens.
My data packet looks like this:
StartString:=#1
StopString:=#4
Example packet (dec values):
1 107 4 139 57 42 44 85 255 58 212 63 4
This is all procedure I receive data and show it on ListBox:
procedure TMainWindow.DataPacketPacket(Sender: TObject; const Str: string);
const FrameStartPos = 0;
const FrameEndPos = 12;
var
RxBuffer: array[1..FrameEndPos+1] of Byte = (0,0,0,0,0,0,0,0,0,0,0,0,0);
c: Integer = 0;
i: integer = 0;
licznik: Integer = 0;
NStr: String;
begin
for i := 1 to 13 do begin
c := ord(Str[i]);
RxBuffer[i] := c;
end;
i:=0;
NStr:=' ';
for i:=1 to 13 do begin
NStr:=NStr + IntToStr(RxBuffer[i]) + ' ';
//ComMemo.Text:=ComMemo.T
end;
if((RxBuffer[1]<>1) Or (RxBuffer[13]<>4)) then
begin
BadDataCnt:=BadDataCnt+1;
BadData.Caption:=IntToStr(BadDataCnt);
end;
Listbox1.Items.Add(NStr);
Serial.ClearBuffer(true, true);
end;
Most of data is correct, but some data has changed order. I mean that:
139 57 42 44 85 255 58 212 63 4 (1 107 4) -> Should be on the beginning of the packet.
As you can see, first three elements are on the end of the packet, and I don't know why.
I noticed that I got all packet when I set Size in TDataPacket on 14, but I've got 13 bytes in packet.
Any ideas about all of that?
Regards,
D.