nrComAfterReceive - Number of received bytes reported - not consistent

Started by Francois, August 06, 2020, 08:18:18 am

Previous topic - Next topic

Francois

The number of received bytes reported by OnAfterReceived event is not consistent. When receiving standard frame of 8 bytes on RS485 network the event reported 20% of times incorrectly. When using other commercial software on the computer to detect the received frame, it was confirmed that the number of bytes is consistent 8 bytes


nrCommLib version V9.33
Development environment : Delphi RadStudio XE2

procedure TForm2.nrComAfterReceive(Com: TObject; Buffer: Pointer;
  Received: Cardinal);
var
  Rs : String;
  i : byte;
begin

  Label3.Caption := IntToStr(Received);
  for i:=0 to Received-1 do
      Rs:=Rs+IntToStr(Byte(PAnsiChar(Buffer)))+' ';

   Label1.Caption := Rs;


end;


Roman Novgorodov

Hello

The nrComAfterReceive raises from thread that monitors incoming buffer of serial port.
It is not loop with fixed delay like in your old slow commercial software.

TnrComm monitor thread provides highest speed of the incoming data processing.

Some more info you can see here:

http://forums.nrcommlib.com/index.php?topic=8.0

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.