HEX Code
Joe Fishback
Posts: 99
I understand the Hexadecimal and Binary code systems usually, but I have run into the HEX number being different than I understand. For decimal
number 708 the hexadecimal would 2C4. Why would the hexadecimal number be shown as 0x2C4 ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
number 708 the hexadecimal would 2C4. Why would the hexadecimal number be shown as 0x2C4 ?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······ Joe Fishback
-Robots are my friends-
Comments
On a BASIC Stamp you would use $2C4…But 0x2C4 is just another way of representing a hexadecimal number that some people use. I prefer $2C4 myself. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
If it's 708 Hex, then that's really 1800 Decimal.
So, to reduce this confusion, compiler writers (for 'C', in this instance) create some way of designating if a value "literal" is decimal, hex, or binary.
Thus, "708" decimal is the same value as "0x2C4", in 'C' language "literal"s.
In PBasic, 16 decimal would be "$10" hexadecimal, or "%10000" binary.