This is from memory so it may be slightly off but here's how ADI does it for their RS485 devices. Activated devices have addresses from 0-252 (I think) with no gaps. All start with an address of 253 (FE) and as they are added to the network, the master sends a command to FE assigning it the next available address. A variation might work for your purposes.
Looks like they have revised it since I worked with it about 12 years ago. See Section 5.2 (p77) in their manual.
Bookmarks