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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Murray R. Van Luyn
04/06/12 12:04
Modified:
  04/06/12 12:07

Read: 623 times
From Down Under.


 
#187035 - You've been busy.
Responding to: Aubrey Kagan's previous message
Aubrey Kagan said:

I did a series of articles for Circuit Cellar on creating a Modbus Master (March & April 2007) and Modbus Slave (July 2008). The slave was developed on a PSoC, but is almost all in C so it shouldn't be too difficult to follow. (Circuit Cellar's business model is to charge a minimal amount for each article, although the code is available for free.) You may find the articles informative on how Modbus memory can be partitioned.

For your purposes I suggest a register for the Modbus-address at a register address physically separate from the other register addresses (to prevent multi register instructions acting on dissimilar memories). You will need to provide different routines depending on which Modbus register type is being accessed. Associate the the Modbus-address register to a Flash/EEPROM location and when the address is written, you can change the Modbus-address to the new value. Of course you can put safety measures like write-enable bits in some other register. Modbus has a facilty to respond with an acknowledge, and then go away and execute some action that can take some time (like updating the EEPROM). I don't have the details at the moment (I am at home, and this is a long weekend), but if you let me know I will look up the sequence on Monday.

-Aubrey


Hi Aubrey,

Well it looks like you're the man to ask about Modbus client and server implementations. I had a good look at the code that accompanied your Circuit Cellar contributions, and was suitably impressed with your very appreciable efforts.

Well, I've landed upon some of that abundant Modbus code for PIC controllers that you mentioned, and it looks as though, with some porting effort, it will fit the bill. Programming a register mapped Device ID into any Modbus slave looks like it could be accomplished easily enough. To do this we broadcast a register write command, and provided the specific slave device's unique serial number, along with the new device ID, to individually select it for address update. Collecting serial numbers by broadcasting discovery requests is where it gets tricky, though employment of a CSMA/CA scheme with truncated binary exponential back-off might limit the required number of contentious discovery cycles to just a few. The slaves that have been successfully identified during each discovery cycle, are immediately commissioned between discovery requests, and so take no further part in subsequent identity reporting competition.

Gad, that sounds like a lot of work.

Murray R. Van Luyn.


List of 5 messages in thread
TopicAuthorDate
Data Link Layer for RS485?      Murray R. Van Luyn      04/05/12 11:37      
   Modbus      Aubrey Kagan      04/05/12 13:13      
      Yep, Modbus Fits The Bill.      Murray R. Van Luyn      04/05/12 14:49      
         Changing the Modbus Address      Aubrey Kagan      04/05/12 17:05      
            You've been busy.      Murray R. Van Luyn      04/06/12 12:04      

Back to Subject List