Readrive
Readrive

Reputation: 1

How to calculator modbus RTU timer period?

I'm using the dsPIC33ck128mc105 and the FreeModbus library.

I need to add Modbus RTU (RS232), but I'm facing a small problem. I understand the timer period calculation as "11 bits / UART baud rate * 3.5".

I'm using a 9600 baud rate, but the 4.01ms or 4.04ms settings aren't working. The RX pin is functioning correctly, but the TX pin isn't sending data. I can tell because I have LEDs connected to the RX and TX pins.

I decided to increase the timer period because I was only able to get two values from the U1RXREG. When I changed the timer period to 8.08ms, it worked.

Interestingly, when I tried RTU with 485, it worked sometimes and sometimes it didn't with the 8.08ms setting. I haven't tried RS232 for long, but it has been running fine all day so far.

Why did increasing the timer period to 8.08ms make it work?

Upvotes: 0

Views: 88

Answers (0)

Related Questions