• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 
April 26, 2024, 01:59:31 pm

News:

SMF - Just Installed!


Best way to poll MODBUS

Started by Selim, August 01, 2013, 11:07:04 am

Previous topic - Next topic

Selim

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...

Regards...

Roman Novgorodov

Hello

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.