I am trying to connect Adafruit I2C 4 digit 7 segment displays using Pins 14 for SCL and 15 for SDA on the Prop-2. I have been reviewing Stampworks and the N&V article about I2C but I am having issues with the slave addresses. The addresses I have on each display is 0x70 and 0x74, but I seem to have issues with trying to talk to the devices.
Has anyone used these displays before with the prop-2 and if so, do you have any sample code I could review?
I've used them with the HC-8+ (Propeller), and I wrote StampWorks, so I should be able to translate the code. Give me a little time.
Here is a demo for you to start with: it displays a running counter on the 7-segment display. I used the low-level routines from my StampWorks programs, then created a couple medium-level routines for the display.
The Adafruit 7-segment display is tricky for two reasons:
1) It uses the HT16K33 driver which has 16-segments per digit (only the lower 8 bits are used)
2) It maps the colon to digit 2 in the display, so you have to code around that
No matter what, do study the HT16K33 documentation (https://cdn-shop.adafruit.com/datasheets/ht16K33v110.pdf). It is a bit difficult at first, but reviewing it with the code may make things a little easier.
Be mindful of the connections -- you must disconnect the ULN from pins used the SCL and SDA. On the Prop-2 I prefer pins 14 and 15 for this connection.
If you ever move to the HC-8+, I have objects that encapsulate all the features of the HT16K33, and I have variants for the 7- and 14-segment displays.
PS: Adafruit docs are Arduino-centric, hence addresses are 7-bit (without read/write bit). In my program you'll find this:
HT16K33 CON %11100000 ' base device ID
DevAddr CON %000 ' %000..111
SlaveID CON %11100000 ' manual build
If you take my base ID (%11100000) and shift it right by one (as the Arduino does), you get %01110000 which is $70.