Olin Lathrop wrote: > Jamie Jensen wrote: >> before i reinvent the wheel...is there code sitting out there that will >> translate I2C to SPI and visa versa? i want to drop it in on a I2C bus >> that has a SPI device as well. > > It doesn't just work like that. IIC has addresses, SPI does not, for one > thing. I think the addresses are a minor problem... you could just assign an I2C address to your protocol translator. But many SPI devices send data while receiving data, which is not possible on the I2C bus; for example, they send out a status byte while they are receiving a command byte, on the first eight clocks. I think you have to come up with an I2C protocol that reflects the functionality you need from the device, and implement that and its translation into the device's SPI protocol. Since this seems to be quite dependent on the specific device, I'm not sure there can be a universal solution. Maybe... if you write the I2C protocol so that it always initiates from the master, and always writes one byte then reads one byte. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist