I2C examples please
archerbrad700
Posts: 18
Hello there,
I am hoping someone knows of and can link me to a thread that explains I2C with the propeller, I have 3 slaves, one of them the system EEPROM, and the other two are air data sensors. I don't quite know where to start in writing code to get data from the sensors. Maybe some example code that has the propeller communicating with multiple slaves would help. I plan on using the basic_I2C_Driver object.
Thanks in advance for any help, and sorry if the questions has been asked many timed before like I assume it has.
I am hoping someone knows of and can link me to a thread that explains I2C with the propeller, I have 3 slaves, one of them the system EEPROM, and the other two are air data sensors. I don't quite know where to start in writing code to get data from the sensors. Maybe some example code that has the propeller communicating with multiple slaves would help. I plan on using the basic_I2C_Driver object.
Thanks in advance for any help, and sorry if the questions has been asked many timed before like I assume it has.
Comments
"Help me with I2C" is a bit of a broad question. If you have something more specific we can be of more help. You could try working on the code yourself, and posting if you have issues. You might also want to post links to the datasheets of the parts that you are using (after reading them, of course). Doing these can help make it easier on us to provide quality help.
Also, many OBEX objects come prepackaged with sample (demo) code showing how to use the driver. Take a look at a few, even if you aren't using them: most Propeller I2C drivers work similarly.
pcf8593 - Archive [Date 2012.10.01 Time 21.08].zip
I2C with an EEPROM is easier than with other devices since the Basic I2C Driver object has the basics down. When you are using other devices then you will have registers on the devices to write to and to read from. Once you have those down pat in understanding then its easier to have your main program to talk to the devices.
Here is a simple object (MCP23008) I wrote that goes out from the register numbers and make it into register name calls.
And then a more complex one for the PCF8593 RTC Clock.
Have a look at the files I have uploaded to see if you can understand the basics behind the I2C protocol.
Regards,
So I have a few articles where I go into connecting i2c modules such as the altimeter module, compass module, and gyroscope module I believe with i2c.
Just in case you don't know what i2c is: http://tymkrs.tumblr.com/post/11356800838/propeller-general-i-o-pins-explained
And my own method of hooking these up i2c style: http://tymkrs.tumblr.com/post/29761832891/experiments-and-attempts-at-i2c-fingersmash-rev-0-01 and http://tymkrs.tumblr.com/post/30873072201/experiments-and-attempts-at-i2c-fingersmash-rev-0-02
Hope this helps a bit!
Addie of Tymkrs