cancel
Showing results for 
Search instead for 
Did you mean: 

I2C send_data

aymen
Associate II
Posted on June 06, 2016 at 09:28

hi,

I'm using stm32f103rct6 to communicate with OPT3001 sensors.

I use I2C1 for the configuration

to read data from 16bits register it's done but I have problem to send 16bits data.

I used this function when I tried to read the same register I find juste one Byte.

void I2C_SendData(I2C_TypeDef* I2Cx, uint8_t Data)

{

  /* Check the parameters */

  assert_param(IS_I2C_ALL_PERIPH(I2Cx));

  /* Write in the DR register the data to be sent */

  I2Cx->DR = Data;

}

have any one solution?

thanks
4 REPLIES 4
Radosław
Senior II
Posted on June 06, 2016 at 10:10

I2C protocol don't supprort 16-bit data.

I2Cx->DR is 8-bit.

aymen
Associate II
Posted on June 06, 2016 at 10:18

SO?

I can't use stm32f10x ?

Radosław
Senior II
Posted on June 06, 2016 at 11:32

SO read bytes....  

Posted on June 06, 2016 at 13:20

So break the 16-bit word into high and low bytes and send the after each other.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..