Other Parts Discussed in Thread: MSP430G2553
Hi,
I am working on MSP430G2553. I need to implement MODBUS RTU over RS232. The 2553 will act as a slave. I have understood the entire protocol but have some difficulty in understanding the Start and Stop silent interval. I have already written a code for ModBus Ascii which is working perfectly. In Modbus Ascii, it was easier to detect the start and stop of a frame since I could just compare inputs to : and 0x0D & 0x0A. However in Modbus RTU, the silent interval is a bit confusing.
- Does the silent interval of 3.5 char times(4.01ms for 9600 BR and 11 bits) mean that I have to wait for this time before a character is received? How does the slave get triggered initially?
- And how do I go about this timing? I mean what should be the general flow of the timing? When the controller is initialized, suppose I start a timer for 4.01ms, what if I receive an RX interrupt before this 4.01ms? Should this char be ignored and the time counter reset and we wait for the next character? How to ensure that this character is an address byte? And what if the next character is not an address byte?
- What if there is nothing transmitted from the master for more than 4.01ms? Should the counter be kept incrementing till a character is received? Won't the counter overflow if nothing is received from the master?
I may have asked a lot of questions which might be a bit silly. May be I am going in the wrong direction. But a reply from anyone having implemented MODBUS RTU over RS232/RS485 using MSP430G2553/MSP4305438 would be very useful. Please provide a general flow of the program just for the start and stop timing. The rest of the packet and CRC check wont be needed to be explained.
Thanks,
Tanmay Gadekar