Binary, and Hex question.

jsbush

Diamond Member
Nov 13, 2000
3,871
0
76
How does FF (F=15) end up being 255? And how does 128 end up being a hex of 80?

How do you do the converstions from binary to hex?



Thanks.
 

emmpee

Golden Member
Nov 26, 2001
1,100
0
0
to convert from hex to decimal, multiply the rightmost digit by 16^0, the second right-most by 16^1, etc etc etc.

15 * 16^0 = 15
15 * 16^1 = 240
240 + 15 = 255

to go from binary to hex, take the binary digits in groups of 4 starting from the right. convert each group of 4 to a hex value. if you have less than 4 digits left, add leading zero's.

eg:

1110100101011

1011 = 11 (B)
0010 = 2
1101 = 13 (D)
0001 = 1

1110100101011 = 1D2B
 

mee987

Senior member
Jan 23, 2002
773
0
0
16 is your base. the far right place is 16^0 (ones). the left place is 16^1 (sixteens). so you have 15 sixteens (240) and 15 ones (15). that makes 255.
 

jsbush

Diamond Member
Nov 13, 2000
3,871
0
76
Oh ok I get it now.

8 = 1000

and

0 = 0000

so 80 equals 128 because 10000000 is 128

same with F
F = 1111
so FF = 11111111 and 11111111 is equal to 255



Thanks.
 

RossGr

Diamond Member
Jan 11, 2000
3,383
1
0
The conversion from binary to hex is very straight forward, no need to involve decimals. 1 hex digit is 4 binary digits.

Binary__Hex
0001 __ 1
0010__ 2
0011 __ 3
0100 __ 4
0101 __ 5
0110__ 6
0111 __7
1000 __ 8
1001__ 9
1010 __ A
1011 __ B
1100 __C
1101 __D
1110__ E
1111__ F


If you have 16 binary digits break it into 4 pieces and convert each to Hex
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
What everyone is talking about is not special to binary, hexadecimal, or any other number system; rather, it's simply the place-value system, a system that's independent of the base. You can thank the precocious Babylonians for said system.
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
178 in decimal = 1 * 100 + 7 * 10 + 8 * 1

Use similar logic in hex:

0xFF = 15 * 16 + 15 * 1

 

Cal166

Diamond Member
May 6, 2000
5,081
8
81
Took this class two semester's ago called Assemble Language. We had to write our own programs from scratch.
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Originally posted by: Cal166
Took this class two semester's ago called Assemble Language. We had to write our own programs from scratch.

As opposed to....... instant programs? I believe you mean assembly (some call is assembler, but that's technically incorrect as well) language.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |