MM DS3231, BMP180 and I2C
| Author | Message | ||||
| CaptainBoing Guru Joined: 07/09/2016 Location: United KingdomPosts: 2171 |
Jim is quite right about the datasheets - they will contain all the info you need but it might be a bit cryptic... learning to read them is a bit of a dark art and they all vary in style a bit so you might have to hunt around and "read between the lines". The DS3231 is a good example; nowhere does it say "the device responds to address....." etc. you just have to glean that info when you look at the timing and data format diagrams. Cute. You can always ask here one thing to remember is that some devices might have address pins on the chip that you have to tie hi/lo in the right pattern (or drive from IO on the pic if that is the flxibility you need - I did this when I needed more 24Cxx EEPROMS on the i2c than I could get with the address bits on offer). These allow you to set the lower 2 or 3 bits (sometime as many as 6!) of the address, so the address specified in the PDF is only a base or starting point - the tiny EEPROM 24Cxx range is a good example here - this is so you can stack several of them on the same bus really easily and have no conflicts when you talk to them. You have your base address plus the binary on the address select pins whch forms the address you use in the i2c routines. It will all "click" into place I promise you. as an aside, this link has the addresses of common i2c chips and is a good start, but not everything is here so you may still end up to your ears in PDFs hth h |
||||