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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/06/12 18:04
Modified:
  04/06/12 18:07

Read: times


 
#187035 - You've been busy.
Responding to: ???'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?            01/01/70 00:00      
   Modbus            01/01/70 00:00      
      Yep, Modbus Fits The Bill.            01/01/70 00:00      
         Changing the Modbus Address            01/01/70 00:00      
            You've been busy.            01/01/70 00:00      

Back to Subject List