SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
#178896
I have tried both the Serial7Segment and the OpenSegment displays on my AVR through the i2c bus and have failed both times. I am NOT using Arduino. I have tried this across two different AVRs with both the hardware TWI library and two different software libraries. This has been the cause of some major headaches for me. Phoenix123 posted a solution on the blue OpenSegment display's comment section that can be found here: https://www.sparkfun.com/products/11647

Essentially, when an Arduino sends the device address through its Wire library, it shifts the address left one bit and then adds the R/W bit. This turns the serial display's address from 0x71 to 0xE2. Since the hardware TWI and software libraries I have tried do not shift the address, the Arduino on the display was not receiving the expected address.

I originally thought this was a bug in the Arduino Wire library, but after thinking about it, I'm not so sure. If this were a bug in the library, no Arduino would work with any i2C device. It would appear that i2c devices are expecting the address to be shifted left by one bit. I just found this information out and haven't had time to research the i2c specifications, so I do not know for sure if this is correct or not.

Anyway, if anyone is having trouble trying to drive these displays with the i2c bus and is not using Arduino, the solution seems to be to simply shift the address left.
#178970
Well, I feel stupid! Always read the specifications rather than simply relying on a library to do the work for you! This came down to me thinking that the i2c device was expecting an 8-bit byte, as stored in memory. This is NOT the case! The address is 7 bits. When stored in an 8-bit memory location, as would be necessary on today's hardware, the 7-bit address has to be shifted left one bit into the 8-bit byte to make room for the R/W bit that resides at the LSB. If I had read the specification, this would have saved me a ton of headaches!

I was sending the display 0x38 for the address and then telling it I was going to be reading data (R/W bit set to 1), while trying to write data. Poor, confused display!

Here is a visualization, should anyone in the future run into this trouble. Again, study the specification.

Image