??? 03/03/08 22:49 Read: times |
#151836 - Problem? Responding to: ???'s previous message |
In the code I posted there is the rxrtu routine - this does what you need. For the RTU timeout, I used the uart transmit as a timer as I didn't have another spare timer. This works fine if you're using RS485 as the '485 tranceiver is half duplex and the transmit characters used for timing don't get output (since you're receiving during this time). However, if you're using RS232, this scheme won't work - you'll need to use another timer. Basically you load a timer with the 3.5 character times when you receive a character. The timer is setup to interupt when it expires. When the timer expires, this should be the end of the Modbus packet.
Jacob - at 38400 baud, each character takes 260us (10 bits/char). |
Topic | Author | Date |
MODBUS RTU for 8051/DS89C450 | 01/01/70 00:00 | |
How to post source code | 01/01/70 00:00 | |
Formatted Source Code | 01/01/70 00:00 | |
Looks like translated PIC code! | 01/01/70 00:00 | |
So where is the problem? | 01/01/70 00:00 | |
More details... | 01/01/70 00:00 | |
How did you test your VC++ app...? | 01/01/70 00:00 | |
uC -> RTU Slave (OK) ; RTU Slave -> uC (FAIL) | 01/01/70 00:00 | |
RE:8 bit buffer | 01/01/70 00:00 | |
Problem? | 01/01/70 00:00 | |
RE:8 bit buffer![]() | 01/01/70 00:00 | |
RTU Communication is working! | 01/01/70 00:00 |