I'm trying to reading a simple string from host on Serial line RS232. The parameters of receive - transmission are the same for both: Baudrate: 9600; Data: 8bit; Parity: None; Stop: 1bit; Flow Control: None; I've tried to send this string:!A243B324C213D300# I use '!' And '#' as header and finish to be sure the string will be received at all. The problem is that I can receive the string until the 15th character (3). I know this because if I use this code: procedure TForm1.ComPort1RxChar(Sender: TObject; Count: Integer); begin ComPort1.ReadStr(Str, Count); memo1.Lines.Add(str); end; I will see!A243B324C213D3 00# I've tried to extend the buffer of the comport, without results. So why I can't receive the complete string in one shot?
Youtube music aaron copland at the river. I found this library here and it works fine until now. With TComPort component comes another one: TComDataPacket. Simply connect this to TComPort, setup StartString and StopString properties and use event onPacket to get complete data.
ComDataPacket1.Comport:= Comport1; ComDataPacket1.StartString:= '!' ; ComDataPacket1.StopString:= '#'; ComDataPacket1.onPacket:= ComDataPacket1Packet. //this is real code from one of my applications where I use it for barcode reader service procedure TDM.ComDataPacket1Packet(Sender: TObject; const Str: string); begin BarCodeReader.Barcode:= Str; end.