using sx28 as an i2c slave
Hey guys... so, I'm trying to write a program that receives an i2c signal (from an arduino http://www.arduino.cc/en/Main/ArduinoBoardDiecimila) using SX Basic and an SX28. It's part of a slightly grander scheme, but my basic problem is catching the i2c with the SX28. I've succesfully written code which uses the SX28 as an I2C master, and writes data to a slave chip (memory), but I haven't managed to get the I2CRECV command to work when I want to use the SX28 as a slave rather than a master.
Does anyone have any example code of how to do this? And is it even possible?
Does anyone have any example code of how to do this? And is it even possible?
![roll.gif](http://forums.parallax.com/images/smilies/roll.gif)
Comments
The I2CRecv is used to receive data from an I2C slave (with the SX as the master).
Making the SX an I2C slave is completely different.
I've experimented with this a couple times but never really had the time to get it working properly.
I have posted code to make the SX an SPI slave. I'd have to search for it if you are interested. It's in the forum somewhere.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
·
Yeah, i tried something similar, using an interrupt routine to store changes in the SDA and SCL, and then going through those and working out what they meant. I'm a bit of an SXB rookie, so I haven't managed to get it running fast enough. Doh! Sadly, the hardware is already built, and only has 2 wires, so I guess I'll just code a simpler, slower i2C-type thing (speed isn't really an issue here)
JonnyMac - that sounds perfect - not sure if I have time to order the book though - my deadline's thursday! Anyone know if there's some online examples?
Cheers
d
Attached is a simple SX/B program for a specific type of I2C Slave. It does not have all the features a slave might require, but it can give you a good start on what is needed. It does not have time stretching that I2C slaves might be required to have. And the program does not contain code for the transmission of information back to the master. Basically, the code just receives data from the Master and then within the main program there is a decision as to whether the code is directed at this slave device or not. We wrote this code to simply receive information from a I2C Master and then act upon its commands. Our slave did not send any information back to the Master other than the ACK after receiving each byte.
Gary
d