element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Azure Sphere Starter Kit
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Azure Sphere Starter Kit
  • More
  • Cancel
Azure Sphere Starter Kit
Forum Azure Sphere - How to read and write 16-bit register using I2C
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Azure Sphere Starter Kit to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 2 replies
  • Subscribers 44 subscribers
  • Views 1268 views
  • Users 0 members are here
  • i2c
  • azure sphere
  • mt3620
Related

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

FrankSteven8877
FrankSteven8877 over 2 years ago

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.

  • Sign in to reply
  • Cancel

Top Replies

  • shabaz
    shabaz over 2 years ago +1
    Hi, I2C low-level protocol doesn't have a concept of 16-bit registers. If you're new to the field, you really do need to read the I2C specification, it is not very long, or at least the I2C Wikipedia…
  • bwilless
    bwilless over 2 years ago +1
    shabaz is correct, you need to look at the device datasheet to understand what to send to your device. What device are you using? Have you looked at any of the i2c examples that are available? Once you…
Parents
  • bwilless
    bwilless over 2 years ago

    shabaz is correct, you need to look at the device datasheet to understand what to send to your device.  What device are you using?  Have you looked at any of the i2c examples that are available?  Once you understand what the device requires, you create the message in your code and send it to the device.

    Simple example by MSFT:  azure-sphere-samples/Samples/I2C at main · Azure/azure-sphere-samples (github.com). 

    Look at the ResetAndSetSampleRange() function in main.c line 251 for a working example.  Note that a i2c command gets created in a uint8_t array, and the command gets sent to the device.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • bwilless
    bwilless over 2 years ago

    shabaz is correct, you need to look at the device datasheet to understand what to send to your device.  What device are you using?  Have you looked at any of the i2c examples that are available?  Once you understand what the device requires, you create the message in your code and send it to the device.

    Simple example by MSFT:  azure-sphere-samples/Samples/I2C at main · Azure/azure-sphere-samples (github.com). 

    Look at the ResetAndSetSampleRange() function in main.c line 251 for a working example.  Note that a i2c command gets created in a uint8_t array, and the command gets sent to the device.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube