Azure Sphere - How to read and write 16-bit register using I2C

Frank 0 Reputation points
2023-02-24T22:21:10.9733333+00:00

I am new to this field. I saw an example of read and write 8-bit register using I2C. How to read and write a 16-bit address register? 

Example: the register address is 0x0158, how to use I2CMaster_Read to read the value

Example: the register address is 0x0158, and I want to write 0x01 to this register. How to use I2CMaster_Write to change the value.

Azure Sphere
Azure Sphere
An Azure internet of things security solution including hardware, operating system, and cloud components.
156 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 27,491 Reputation points
    2023-03-01T11:41:44.97+00:00

    Frank Welcome to Microsoft Q&A forum!

    Apologies for the delayed response.

    I saw an example of read and write 8-bit register using I2C. How to read and write a 16-bit address register? the register address is 0x0158, and I want to write 0x01 to this register. How to use I2CMaster_Write to change the value.

    Can you share more details about the examples you are referring to? Did you check the I2C samples that demonstrate I2C functionality on the Azure Sphere platform?

    Have a look at the I2CMaster_Read Function and the sample https://github.com/Azure/azure-sphere-samples/blob/fe8117ba45404e6e0f48546c7bca9c2d2074c3ad/Samples/I2C/I2C_LSM6DS3_HighLevelApp/main.c and let us know if that helps.

    If you need further help in this matter, please comment in the below section and we are happy to discuss!


    If this answers your query, do click Accept Answer and Yes for this answer as helpful. And, if you have any further query do let us know by commenting in the below section.

    0 comments No comments