cancel
Showing results for 
Search instead for 
Did you mean: 

i2c send data stm8s105

fenerlibora
Associate
Posted on July 15, 2013 at 16:48

 I want to send below command with i2c but i cant do it. I use stm8s105c6 and i can send one data each start with i2c.0690X00000604r4QAA.png

1 REPLY 1
fenerlibora
Associate
Posted on July 16, 2013 at 10:12

I2C_GenerateStart(ENABLE); 

while(!I2C_CheckEvent(I2C_EVENT_MASTER_MODE_SELECT));  

  /* Send EEPROM address for write */

  I2C_Send7bitAddress(0x70, I2C_DIRECTION_TX);

 

  /* Test on EV6 and clear it */

  while(!I2C_CheckEvent(I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED ));

  I2C_ClearFlag(I2C_FLAG_ADDRESSSENTMATCHED);

  /* Send Address (on 2 bytes) of first byte to be written & wait event detection */

  I2C_SendData(0xC8); /* MSB */

  /* Test on EV8 and clear it */

  while (!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING));

  I2C_SendData(0xaa); /* LSB */

  /* Test on EV8 and clear it */

  while (!I2C_CheckEvent(I2C_EVENT_MASTER_BYTE_TRANSMITTING));//////Stuck here my code

 

I2C_GenerateStop(ENABLE);