modbus with programmable xbee

hi all,
I’d like to use the programmable xbee to make an “xbee-modbusRTU” interface.
I’m wondering how I can use a modbus library with the freescale microprocessor.
Is it possible? Is there a preferable library to do this?
Thank you for answer !

[edit]: here’s a link to an interesting discussion on the subject if u’re interested ^^

thus, I’m wondering if I need to modify the bootloader to implement modbus on the “host port”?
I hope I don’t need to !
I will receive modbus hexadecimal command Bytes from xbee API, with settings “8N1”(bits/parity/stop bit) , and I 'll just have to modify it to satisfy modbus RTU protocol …

Wow - when it rains, it pours … lots of XBee and Modbus questions in one week :slight_smile:

If your plan is to just answer Modbus/RTU from XBee+API, then you do NOT need Modbus on the serial port.

Your only Modbus protocol chore will be handling the end-of-message issues. Forget the 3.5 char timeout method. Assuming you are only answering a few requests like read holding registers, then after seeing the first 2-3 bytes then you KNOW how long the messages will be.

If the remote is using the Zb fragmentation header, then if it sends 150 bytes, your code will receive a single API frame with all 150 bytes. However, if the remote does NOT use fragmentation, then you WILL receive the message at least 2 API frames with for example 40-70msec gap between.