Number Systems Flashcards
Convert Binary to Decimal
Example: 1011
Multiply each position by 2^x
Example: 1011
=(12^3)+(02^2)+(12^1)+(12^0)
=8+0+2+1
=11(base 10)
Convert Decimal to Binary
Example: 13 (base 10)
Divide by 2, use remainder as indicator until get to 0, and remainder is read upwards
Example: 13 (base 10)
13/2 = 6 remainder 1
6/2 = 3 remainder 0
3/2 = 1 remainder 1
1/2 = 0 remainder 1
=1101 (base 2)
Convert Binary to Hex
Example: 1101001
Group by four, start on right side
Example: 1101001
=0110 1001
=(12^2)+(12^1) = (12^3)+(12^0)
=4+2 =8+1
=6 =9
=69(hex / base 16)
Convert Hex to Binary
Example: 0xA1C
Use the table or each hex digit is 4 bits
Example: 0xA1C
=A =1 =C
=10 =1 =12
=1010 =0001 =1100
=101000011100(base 2)
Convert Decimal to Hex
Example=7562(base 10)
Divide the number by 16.
Get the integer quotient for the next iteration.
Get the remainder for the hex digit.
Repeat the steps until the quotient is equal to 0.
Example=7562(base 10)
Division by 16 Quotient Remainder Hex
=7562/16 472 10 A
=472/16 29 8 8
=29/16 1 13 D
=1/16 0 1 1
=1D8A(base 16)
Convert Hex to Decimal
Example: 1AC
Multiply each hex digit by place using 16^x
Example: 1 A C
=116^2 +A(10)16^1 + C(12)*16^0
=256+ +160 +12
= 428(base 10)
Convert Two’s Compliment
Examples:
1101 1100
- Most significant bit has to be 1 for it to be negative
- begin at the RHS
- copy all zero values up to and including the first one
- flip remaining bits
Example=1101 1100
=00100100
= - (12^5)+(12^2)
=-36
Convert Hex to Date
Date: 0x0D43
- 2 bytes (16 bits) - year, month, day
- Stored in Little endian
- YYYYYYYMMMMDDDDD
○ First 7 bits - year
○ Next 4 bits - month
○ Next 5 bits - day
Date in Little Endian: 0x 430D
Binary: 0100 0011 0000 1101
Broken down: 0100001 1000 01101
Year = 0100001 = 33 (1980+33 = 2013)
Month = 1000 = 8 (August)
Day = 01101 = 13
== August 13, 2013
Convert Hex to Time
Time: 0xDA58
Stored in Little Endian
-HHHHHMMMMMMSSSSS
-First 5 bits - hour
-Next 6 bits - minute
-Last 5 bits - seconds divided by 2
Time in Little Endian = 0x58DA
Binary: 0101 1000 1101 1010
Broken down: 01011 000110 11010
Hour = 01011 = 11
Minutes = 000110 = 6
Seconds / 2 = 11010 = 26 (26*2 = 52 or 53)
== 11:06:52 or 53