Using 12c to write to a 16 bit register #74
Answered
by
MrYsLab
boonsiong123
asked this question in
Q&A
-
Hi...I am using a 16bit ADC (ADS1115). I am trying to configure the ADC. However, the config register in ADS1115 is 16bit. The args in i2c_write allows up to a value of 255. Any way I can get around with this? |
Beta Was this translation helpful? Give feedback.
Answered by
MrYsLab
Feb 26, 2024
Replies: 2 comments 4 replies
-
Same problem here |
Beta Was this translation helpful? Give feedback.
3 replies
-
I just updated my answer since I don't believe it was correct. Again, this is not tested, so if you have any questions, please let me know. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the question. This is accomplished by converting the 16-bit value into two 8-bit values, an MSB and an LSB value. These values are written to the i2c device register.
This article explains how to split a 16-bit value into msb and lsb values using Python.
If you look at line 491 of Rob Tilaart's Arduino library for the device, you will see an example in an Arduino library.
Here is how this might be expressed in Telemetrix: