Forget about decimal places to get started. You will come back to this later.
First you need to see the logic between HEX and BINARY.
Ok, for a byte you have 8 bits (# 7-0)
#7 = 0x80 = %1000 0000
When you read this in binary, in a byte like this,% 00001000
Then the bit is set, is the fourth from right to right aka bit # 3, which has a value of 08 hex (actually also a decimal, but still forgets about the decimal value when you define hex / binary)
Now, if we have the binary number% 10000000 This is bit # 7, which is included. It has a hex value of 0x80
So all you have to do is sum them in "nibbles" (each part of the hex byte is called a piece of some geeks)
the maximum you can get in nibble is (decimal) 15 or F as 0x10 + 0x20 + 0x40 + 0x80 = 0xF0 = binary% 11110000
so all lights on (4 bits) in nibble = F in hexadecimal (15 decimal)
the same applies to lower nibble.
Do you see the template?
Berggreendk
source share