Manually Addressing I2C Slaves and RS-485

I have some general questions about an intended application.

I'd like to have a master device send some data to slaves that are at a very long distance away (500' - 1000'). The slaves then do some work on the data and save it to EEPROM to be used later(when they get the "go ahead" from the master). The data is pretty large and I'd like to save it to external EEPROM.

So, I plan on using NXP's SC16IS762IPW,128 to convert from I2C at the master to RS-485. This is then sent to the slave where the same chip goes from RS-485 back to I2C. The data is processed and then sent to the external EEPROM via I2C (this time no need for RS-485 since the EEPROM chip is right beside the slave).

I need to address both the EEPROM and the slaves. The user needs to be able to manually set the address via rotary switch or similar. So, the thought it that I use some pins on the slave to read the position of some switches. Based on what position the switches are in, the slave decides how to address itself and address the EEPROM, e.g.

void Setup(){
   if (position_A == HIGH){
      Wire.begin(//some address);
      //Write 7 digital pins to set the address on the EEPROM
   }
   if (position_B == HIGH) { 
      ETC ETC
   }

}

Is there any reason why this wouldn't work? Basically I send data from the master to the slave. The slave holds onto the data and sets the address of the EEPROM and then puts the data into the EEPROM. It then may experience some power cycles and etc before it gets a signal from the master telling it to start reading data.

I'm a little uncertain about how this will work. Can a "slave" be a "master" at the same time? That is, can the device I'm calling a slave receive a signals via I2C from the device I'm calling a "master" while ALSO reading data out of the EEPROM?

Is this making any sense or do I just sound stupid?

You don't sound stupid, but I'm not clear on what you mean by having the slave read its address. You need to know the address of the slave in order to talk to it, so if the slave is reading the jumpers to set its address, you don't really have a way to tell the uC what the address is. I2C can have a multiple master bus, but you need something more intelligent that the NXP chip to make this work.

Why not just use some IO pins on the micro controller to set the address? You have plenty of pins to do that. Alternatively, you could use an I2C expander chip. The expander chip would have an address known to the uC that never changes, and it could read pins set by the user. These pins could specify the addresses of the slaves.

skyjumper: You don't sound stupid, but I'm not clear on what you mean by having the slave read its address. You need to know the address of the slave in order to talk to it, so if the slave is reading the jumpers to set its address, you don't really have a way to tell the uC what the address is. I2C can have a multiple master bus, but you need something more intelligent that the NXP chip to make this work.

Why not just use some IO pins on the micro controller to set the address? You have plenty of pins to do that. Alternatively, you could use an I2C expander chip. The expander chip would have an address known to the uC that never changes, and it could read pins set by the user. These pins could specify the addresses of the slaves.

Hmm ... I think I'm confused. The address of the slave will be one of 20 already specified addresses. Basically, I have a "module" that I want to plug in anywhere on a factory floor. If I'm at "assembly station 1", then I set the address of the module to "1", which corresponds to some pre-specified 7 bit address. Then, the master writes different data to each address. So the master doesn't need to know what the address of a specific slave is; the slave just needs to know "where" it is in the network... I'm probably not doing a good job explaining this.

Basically, think of the master as being the center and having it control a bunch of "slots" each with it's own unique address. Now I want to plug a module into a slot but the data I want on the module is dependent upon which slot it is in. So I manually address the module based on which slot I plug it into. The master will write data to all addresses.

Each module has its own unique I2C controlled EEPROM. The question is, after it has been acting as a slave to recieve data and store it in RAM, is there any reason it can't become a master and send that data to it's own EEPROM? I wouldn't have to pipe anything over RS485 at that point. The NXP chip is just to get the data from the master to the modules, from there its up to the module to put it in its own I2C controlled EEPROM (which is local so no need for RS485).