Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Modbus Implementation issue

Status
Not open for further replies.

CrabMan

Member level 1
Member level 1
Joined
Nov 3, 2008
Messages
37
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Location
Pakistan
Activity points
1,548
Hi Everyone!

I am trying to implement ModbusRTU protocol on 8051 based controller. I have read the modbus implementation guide and there seems to be one issue that is bothering me.

The guide says that within a frame there should be no silent interval greater that t1.5(1.5 chars length timer), and two frames should be separated by atleast t3.5(3.5 chars length timer). Then it also says that if there is an interval greater than 1.5 chars, the slave should check if the received message is complete and correct or not, and after t3.5 has expired it should start processing the received command. and somewhere later it says that the end of a message is indicated by t3.5 overflow.

My question is what if there is a reception between t1.5<T<t3.5, what should i do with this byte, should i keep discarding all packets till t3.5 expires, or should i disable the receive mode until t3.5 expires and then enable reception again.


Any replies regarding this issue will be helpful


Regards,
CrabMan
 

If you want to implement the protocol exactly, follow the state diagram (Figure 14) in the MODBUS over serial line
specification and implementation guide
. It's absolutely clear regarding your question.
 

Thanks for your reply,
now i have another question, when the master sends a command on serial line, with say 10 slaves connected, now according to implementation guide each slave will keep receiving the command and after it is complete they will check the slave address and in case of correct address only one slave will process and then furnish a reply......
my question is: can i check the slave address field as soon as it is received and stop receiving the preceding bytes if the message is not intended for me. If I do this then how will I know that command and response transmission are complete, and start polling the serial line again?
 

I don't see a general advantage of "stop receiving" for an unadressed slave, but you may want to handle the message as an
invalid one and wait for the 3.5 char timer to expire.
 

what about the reply, when a slave processes the received command, and is ready to reply how long it should wait before transmitting?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top