Forum > Packages and Libraries

TLazSerial : serial port component for Lazarus (windows and linux).

<< < (89/97) > >>

Jurassic Pork:
hello,
BeaglePi, if your received frames have a terminated string (ex: !)  put the data received in a buffer until you receive the terminated string. See the OnRxData of my demo project sertest where the terminated string is char(10) (Linefeed).
Don't use DataAvailable and timer for receive.
Friendly, J.P

mig-31:
Hello BeaglePi,
additionally, in case of MFC you should wait on number of  available bytes (if counted it correctly 40 bytes) to read.




 

Joek:
Please help the fool:
I'm playing with a device that sends binary data of varying lengths. Separated only by a gap of approx. 15ms.
If I receive the data with a commercial terminal, everything is OK - see the hexa output, data sentences indicated by arrows.
But when using LazSerial I get the same data presented differently.
For example hex 00 00 00 00 06 F9 is received as 00 00 00 00 78 86 by LazSerial.

Hexa editor and Memo1 is filled in by the procedure according to the example:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFMain.SerialRxData(Sender: TObject);var Str,HexaS : string;    I: integer;begin  if Serial.Synser.WaitingDataEx < 5 then exit;  Str :=  Serial.ReadData;  KHexEditor1.Append( KHexEditor1.LastVisibleIndex,Str);   for I := 1 to Length(Str) do       begin           HexaS := HexaS + InttoHex(Ord(Str[I]),2)+ ' ';       end;  Memo1.Lines.BeginUpdate;  Memo1.Lines.Add(HexaS);  Memo1.Lines.EndUpdate;  Memo1.SelStart := Length(Memo1.Lines.Text)-1;  Memo1.SelLength:=0;end;             
In the attached figures, identical data are indicated by arrows.
Can someone point me in the next direction?

Jurassic Pork:
Hello,
are you sure of your serial port settings ? what are your serial port settings ? what is your commercial terminal ? Manual or automatic settings ?
Friendly, J.P

Joek:
Thank you very very very much!
Poor communication speed.
It bothered me all day...
Jurassic Pork, You're the boss!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version