Professional Documents
Culture Documents
1 Number Systems
Ab Al-Hadi Ab Rahman
Dept. of Microelectronics and Computer Engineering
The Faculty of Electrical Engineering
Universiti Teknologi Malaysia
Number Systems
Standard number systems
Decimal
Binary
Hexadecimal
Octal
Binary Codes
Binary Coded Decimal (BCD)
Gray Codes
ASCII
Representation of negative numbers
Sign magnitude
1s complement and 2s complement
Arithmetic operations using 2s complement
A.A.H Ab-Rahman January 2009 2
Binary Numbers
Counting in binary and decimal:
Binary Decimal
0000 => 0
0001 => 1
0010 => 2
0011 => 3
0100 => 4
0101 => 5 How to represent 16 in binary?
0110 => 6 => 100002
0111 => 7
1000 => 8 How to represent decimal 33?
1001 => 9 => 1000012
1010 => 10
1011 => 11 What is the value of 1001012
1100 => 12 => 37
1101 => 13
1110 => 14
1111 => 15
A.A.H Ab-Rahman January 2009 3
Binary Numbers (cont.)
Binary number system uses 0 and 1
Example: find the decimal value of 00101
Bit Position: 4 3 2 1 0
Binary: 0 0 1 0 1
0+ 0+ 4+ 0+ 1 =5
1 6 D 9
Hexadecimal: 1 6 D 9 16
=>1x163+6x162+13x161+9x160 = 584910
Binary: 1011111010001
1 3 7 2 1
Octal: 1 3 7 2 18
=>1x84+3x83+7x82+2x81+1x80= 609710
Bit Position: 3 2 1 0 . -1 -2 -3 -4
Binary: 1 0 0 1 .1 0 1 1
Decimal point
Binary: 1 1 0 0 1 .1 0 1 1 1
1 9 B 8
Binary: 1 1 0 0 1 .1 0 1 1 1
3 1 5 6
0.375 x 2 = 0.75 0
0.75 x 2 = 1.5 1
No more fractional number, stop multiply
0.5 x 2 = 1 1
0.375 x 16 = 6 6
No more fractional number, stop multiplication
Binary: 1 + 0 + 1 + 1 + 0 => 22
Gray Code: 1 1 1 0 1
Gray Code: 1 1 0 1 1
+ + + +
Binary: 1 0 0 1 0 => 18