Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/24/03 04:56
Read: times


 
#55302 - RE: 485 Master slave polling protocol
Responding to: ???'s previous message

I have a few suggestions here. Personally for a lot of the equipment I design I use MODBUS protocol (www.modicon.com) and implement only two commands - read multiple registers & write multiple registers. There is two serial flavours for Modbus - RTU and ASCII. ASCII is much simpler as it starts with a : and ends with a <CR><LF> and has no tricky timing so it is easy for a PC to send/receive. RTU requires a timeout of three character times which is easy for a 8051/2 to do.
To receive Modbus ascii I implement a very simple state machine in the receive interrupt to search for the start token ':' then to pull apart the ascii nibbles to form a byte, store the byte and look for a <CR> that signals the end of the packet. When you get the end of packet, set a flag that your non-interrupt codes looks for so that the non-interrupt code knows there is a receive packet available which you check the checksum,address and command then process the data and send a response with the acknowlege or the data requested.
For RTU put each rx char in a buffer and load say timer2 with 3 chars worth of timeout. When timer2 times out(interrupt), set a flag to your non-interrupt code to come and read/process the data.

MODBUS has a simple view of things - registers. These are 16 bit variables - so you read or write registers (there is also bits if you wish and others). If you information fits the register concept it is a very good protocol.

www.win-tech.com have some downloadable tools to talk modbus protocol.

If all this communication stuff seems too hard - use a programmable logic controller.

Cheers


List of 12 messages in thread
TopicAuthorDate
485 Master slave polling protocol            01/01/70 00:00      
   RE: 485 Master slave polling protocol            01/01/70 00:00      
      RE: 485 Master slave polling protocol            01/01/70 00:00      
         RE: 485 Master slave polling protocol            01/01/70 00:00      
      RE: 485 Master slave polling protocol            01/01/70 00:00      
         RE: 485 Master slave polling protocol            01/01/70 00:00      
            RE: 485 Master slave polling protocol            01/01/70 00:00      
   RE: by the way            01/01/70 00:00      
      RE: by the way            01/01/70 00:00      
         RE: by the way            01/01/70 00:00      
         RE: by the way / Code            01/01/70 00:00      
   RE: 485 Master slave polling protocol            01/01/70 00:00      

Back to Subject List