4 Digit 7 SEGMENT LED with HT16K33 I2C Adapter

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
rick43065
 
Posts: 4
Joined: Tue Feb 11, 2014 10:48 pm

4 Digit 7 SEGMENT LED with HT16K33 I2C Adapter

Post by rick43065 »

Hello,

I have been attempting to use the 4 Digit 7 Segment LED w/ HT16K33 I2C adapter, without success. I can't even get a single portion of the display to turn on. I have been at this for three weeks.

I am not using a standard microcontroller kit supported otherwise on this site, however I did purchase the display AND adapter (as well as other products) from Adafruit. I am using a an ARM Microcontroller, specifically the STM32F0308-Discovery board. (Cortex M0). I have implemented many other peripherals on this board and they continue to work well. The I2C2 registers have values consistent with my expectations. (Except for xmit is it the first value sent , see annoted code below)

I have configured the I2C (after much effort), but can't see anything on the display. I am in need of some guidance (sample ARM code for IAR Embedded toolchain preferred as-if ) or more generic actual code that snipet that enables, starts, transmits then ends transmission.

However, I seem to be missing something or many things (not bit shifting, wrong address sent, etc)

My basic code is

void print7SegDisplay(void) {
uint16_t i =0;
uint16_t testdata = 0x7D;

// Configures the slave address to be transmitted after start generation.
I2C_SlaveAddressConfig(I2C2, 0x70);
I2C_MasterRequestConfig(I2C2, I2C_Direction_Transmitter);
I2C_GenerateSTART(I2C2, ENABLE);
I2C_NumberOfBytesConfig(I2C2, 9); // number of bytes to send
I2C_SendData(I2C2, 0x21); // turn on Oscillator This is value in TX register (anticipating ack from Ht16K33? after this code runs
I2C_SendData(I2C2, 0x81); // turn on Display

for (i=0; i<8; i++) {
I2C_SendData(I2C2, testdata);
I2C_SendData(I2C2, testdata >> 8);
}
I2C_GenerateSTOP(I2C2, ENABLE);
}

// note I am not bit shifiting the I2C_SendData(I2C2, value) code literally puts the value in the register and sends it. I am sure this is part of the problem. I am also not waiting for a response prior to sending next byte. (hence the need for some pseudo code)

I am willing to port sample code, test and post back on this site for anyone else using ARM processors. As the existing code I found is for several different displays, and has three includes (all of which need to be ported)

I have experience in soldering so I doubt that is an issue when I assembled the backpack to the LED: However, when something doesn't work it is always best to check all assumptions.

I thank you in advance for any assistance you can provide.

Rick43065

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: 4 Digit 7 SEGMENT LED with HT16K33 I2C Adapter

Post by adafruit_support_bill »

I moved this to the Microcontrollers forums where it might get more visibility from ARM experts. And if you post some photos of your soldering and connections we'll double check that for you too.

rick43065
 
Posts: 4
Joined: Tue Feb 11, 2014 10:48 pm

Re: 4 Digit 7 SEGMENT LED with HT16K33 I2C Adapter

Post by rick43065 »

I will look for the code posting in the microcontroller section.
Here is a picture of the device
Attachments
20140215_083439.jpg
20140215_083439.jpg (166.76 KiB) Viewed 1735 times
20140215_084310.jpg
20140215_084310.jpg (88.52 KiB) Viewed 1735 times

rick43065
 
Posts: 4
Joined: Tue Feb 11, 2014 10:48 pm

Re: 4 Digit 7 SEGMENT LED with HT16K33 I2C Adapter

Post by rick43065 »

Update, I finally got a few random LED's to display,

They key was that a Start/Command/Stop sequence is required for each command using the 12C to 7 Seg Display.

I was writing the entire sequence as start (all commands, all data,) then stop.

I will post updated code when I figure out why the LED mapping is not yet correct.

rick43065

User avatar
onehorse
 
Posts: 17
Joined: Sun Feb 09, 2014 5:13 pm

Re: 4 Digit 7 SEGMENT LED with HT16K33 I2C Adapter

Post by onehorse »

Hi Rick,

I have been using the HT16K33 to drive 4-digit, seven-segment displays with Adafruit's breakout board (identical to the backpack you are using). Here is an example: https://github.com/kriswiner/HT16K33_Display_Driver. The sketch above displays integers and floating points. You might find it useful as a standalone "library" or an augmentation to whatever library Adafruit has. I don't use their library.

I have an STM32F104 Nucleo board and a Discovery board but I couldn't figure out how to get I2C working after a weekend of trying. Do you have a simple Arduino-like example of how to use these boards with I2C? I would expect that anything that works on the STM32F103 would work on the STM32F104 also. I'm hoping your hard-won experience might be very helpful to me. Thanks!

User avatar
onehorse
 
Posts: 17
Joined: Sun Feb 09, 2014 5:13 pm

Re: 4 Digit 7 SEGMENT LED with HT16K33 I2C Adapter

Post by onehorse »

Finally figured out that on mbed, whose compiler I was using for the STM32 Nucleo, the I2C addresses are 8 bit and have to be left shifted by one to work! It took me weeks to figure this out.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”