Author Topic: Don’t get any event on received data.  (Read 1614 times)

vetech

  • Newbie
  • *
  • Posts: 1
    • View Profile
Don’t get any event on received data.
« on: January 08, 2010, 11:04:18 am »
Hi

I have the following code in a constructor for a new class the must handle mu RS232 communication.

  _Comm := TnrComm.Create(nil);
  _Comm.ComPortNo       := comport;
  _Comm.BaudRate        := 4800;
  _Comm.ByteSize        := 8;
  _Comm.StopBits        := sbOne;
  _Comm.Parity          := pNone;
  _Comm.EventChar       := #0;
  _Comm.UseMainThread   := true;
  _Comm.TimeoutWrite    := 100;
  _Comm.TimeoutRead     := 100;
  _Comm.BufferInSize    := 8192;
  _Comm.BufferOutSize   := 8192;
  _Comm.RS485Mode       := false;
  _Comm.StreamProtocol  := spNone;
  _Comm.TraceStates     := [tsRxChar];
  _Comm.TerminalUsage   := tuNone;
  _Comm.TerminalEcho    := false;
  _Comm.EnumPorts       := epQuickAll;
  _Comm.DataProcessor   := _CommPack;

  _CommPack := TnrDataProcessor.Create(_Comm);
  _CommPack.DataPackets.Add;
  _CommPack.DataPackets.Items[0].PacketLengthMax  := 100;
  _CommPack.DataPackets.Items[0].Active          := true;
  _CommPack.DataPackets.Items[0].PacketLength    := 0;
  _CommPack.DataPackets.Items[0].PacketBegin     := chr(1);
  _CommPack.DataPackets.Items[0].PacketEnd       := chr(13);
  _CommPack.DataPackets.Items[0].ResetOthers     := false;
  _CommPack.DataPackets.Items[0].PacketEndByTimeout := FALSE;
  _CommPack.OnDataPacket                         := NewBCUData;
  _CommPack.Timeout                              := 100;

  _CommPack.Active        := true;
  _Comm.Active            := true;

My new class can send but nothing is received data nor do I get any event even  that I am 100% sure that date is send to the selected comport. Do I missing something the TnrDataProcessor or is something else wrong – pleas give me a hint .

Best regars

Johnny Hansen

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Don’t get any event on received data.
« Reply #1 on: January 09, 2010, 01:48:46 pm »
Hello

Do you show me a relal sample of source code?

I see a strange thing:

Code: [Select]
...
_Comm.DataProcessor   := _CommPack;
_CommPack := TnrDataProcessor.Create(_Comm);
...

It seems like _Comm.DataProcessor property is still NULL value, because you create TnrDataProcessor later.

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