Author Topic: Best way to poll MODBUS  (Read 1262 times)


  • Newbie
  • *
  • Posts: 1
    • View Profile
Best way to poll MODBUS
« on: August 01, 2013, 02:07:04 pm »
Hi there;
I am trying to develop a modbus rtu master application which communicates several slave devices through RS485. How should I handle data communications?
Because of the nature of the modbus protocol, my received data packets have predefined headers (bus address + function code) and known length. But footers may vary (they ends with crc).

When I request data, I set TNrDataProcessor packet as follows:

DataProcessor.DataPackets[0].PacketBegin:=chr(id);  // where id is slave I negotiate at the moment
DataProcessor.DataPackets[0].PacketLength:= 5 + 2*registercount; // how many words do I requested to read from slave... where 5 is modbus header + CRC

But this arrangement does not trigger TForm1.DataProcessorDataPacket() event. What should I do? Do I have to handle TForm1.DataProcessorDataPackets0PacketLength() event? By the way what is IsHandled variable used by this event?

I have very limited time. Could you please Show me the right way to use poll modbus? Thank you very much in advance...


Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1016
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Best way to poll MODBUS
« Reply #1 on: January 16, 2014, 06:52:07 am »

Latest version of nrComm Lib includes TnrModbus component.

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