Skip to main content
aymen
Associate III
June 6, 2016
Question

I2C send_data

  • June 6, 2016
  • 4 replies
  • 1104 views
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
    This topic has been closed for replies.

    4 replies

    Radosław
    Associate II
    June 6, 2016
    Posted on June 06, 2016 at 10:10

    I2C protocol don't supprort 16-bit data.

    I2Cx->DR is 8-bit.

    aymen
    aymenAuthor
    Associate III
    June 6, 2016
    Posted on June 06, 2016 at 10:18

    SO?

    I can't use stm32f10x ?

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

    SO read bytes....  

    Tesla DeLorean
    Guru
    June 6, 2016
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..