Modbus Autodetect Function

K

Thread Starter

Kevin

Hi everybody!!!

I'm developing a KWh datalogger running on RS485 MODBUS RTU protocol based on microcontroller. This logger is connected to up to 64 Kwh meters also running on MODBUS RTU. So far I can talk to the slaves (KWh meter) but i want to write an autodetect routine for this project. The problem I could find is that when I send a Loop back funtion (Function Code 08) to a slave address not connected to the bus, my program will get stuck waiting for the reply of the selected slave. what can I do???

Thanks

Kevin
 
A poll request (Function Code 8) is the right thing to do. Your program should not hang - it should time out.

You also need to consider what will happen if a slave goes off line. If your timeout period is 2 seconds, you have 3 retries and 5 slaves fail then you are going to sit and wait for a while.

Make the timoeout period as short as possible.
 
To Max Power:

It is nice the comment about some devices do not support function code 8, therefore, what is your suggestion??

Thanks

Kevin
 
Thank you very much for your suggestion. I was think in something like that but I couldnt figure out how to do the timeout using microcontrollers.

Best regards

Kevin
 
No suggestion, just a comment.

I give you a valuable piece of advice and you complain about it. If you need your hand held, then so be it. I am not going to hold it. Do it yourself.
 
A
can anybody give me some documents for to develop a device with modbus rtu protocol using 8051 microcontroller language?

Ankit rana
 
Top