0
\$\begingroup\$

I have setup the following circuit in Proteus :

enter image description here

A PIC12F1822 is connected to a HT16K33 using an I2C bus. I want to configure the HT16K33 to use the following address :

A0 = 1 A1 = 0 A2 = 0

I have setup the pins as explained in the HT16K33 datasheet:

enter image description here

According to the documentation, the address send by the master should be :

1 1 1 0 A2 A1 A0 R/W

I send 0xE2 (0b11100010). However, it does not work, the HT16K33 does not send a ACK :

enter image description here

Here is my code :

I2C1_Init(100000);
I2C1_Start();
I2C1_Wr(0xE2);

If I send 0xE0 (the default address), it works (a ACK is send).

\$\endgroup\$
1
\$\begingroup\$

I came to conclusion that the HT16K33 chip need some time to initialize and setup the addressing. Otherwise, the PIC send the data over the I2C bus too early and the HT16K33 is not ready. Adding a small delay before sending the data solve the problem (a ACK is send) :

void main() {
   delay_ms(10);

   I2C1_Init(100000);
   I2C1_Start();
   I2C1_Wr(0xE2);
}

Maybe there is a better way to achieve this.

\$\endgroup\$
1
\$\begingroup\$

From tigrous responses, and according to the datasheet (page 8):

Data transfers on the I2C-bus should be avoided for 1 ms following a power-on to allow completion of the reset action.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.