How do I convert from the Hex to base 10? (0xC4 = 196, which exceeds 127)?

How do I convert from the Hex to base 10? (0xC4 = 196, which exceeds 127)?

6 years 4 months ago
#62
(This message was transferred over from our old forum)
Posted August 14, 2015
By Todd DeBoer
[hr]
“I am using PSoC Express to control the LED driver on the PCA9633DEMO board.

The ALT LED Driver in the schematics state that the I2C address is 0xC4. PSoC Express wants me to input
the address as a number from 0 to 127. How do I convert from the Hex to base 10?
(0xC4 = 196, which exceeds 127).”
[hr]
(Follow up post)

Answered:

I2C addresses can be confusing because they are 7 bits and sometimes they are left shifted by 1 and sometimes they are not.
For the 0xC4, this is:

1 1 0 0 0 1 0 x

Where x is a 1 or a 0 depending on if you are doing an I2C read or write.

At Future Designs, the address is always an 8-bit value with the address in the upper 7 bits and the lowest bit a 0.

To convert back, just drop the lowest (always 0) bit:

1 1 0 0 0 1 0

This gives the value 0x62 (98 in decimal).

Please Log in or Create an account to join the conversation.

Time to create page: 0.445 seconds
Powered by Kunena Forum