cancel
Showing results for 
Search instead for 
Did you mean: 

STM8s003f3 with i2c LCD (PCF8574AT I2C Module)

pverm.19
Associate

Hello Every one ,

I am trying to use I2c based LCD with stm8s003f3 controller. the write i2c address is 0x3f

I am struck at a point ,the code is stopped in endless loop in below function

void PCF8574_write(unsigned char data_byte)

{

  I2C_GenerateSTART(ENABLE);

  while(!I2C_CheckEvent(I2C_EVENT_MASTER_MODE_SELECT));

  

  I2C_Send7bitAddress(PCF8574_address, I2C_DIRECTION_TX); 

  while(!I2C_CheckEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));

  

  I2C_SendData(data_byte);

  while(!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTED));

  

  I2C_GenerateSTOP(ENABLE);  

}

When i have debbuge the above function i saw that it was getting I2C-> SR1 = 0 but it should be 1.

clock frequency is 100 Khz

I2C address is 0x3F

I have also try to change i2c address but it is showing same problem.

Please tell me if i am forget any specific things to declare

0 REPLIES 0