Professional Documents
Culture Documents
1 – Number Systems
Number Systems
• Standard number systems
– Decimal
– Binary
– Hexadecimal
– Octal
• Binary Codes
– Binary Coded Decimal (BCD)
– Gray Codes
– ASCII
• Representation of negative numbers
– Sign magnitude
– 1’s complement and 2’s complement
• Arithmetic operations using 2’s complement
2/18/2012 A.A.H Ab-Rahman, Z.Md-Yusof 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
2/18/2012 A.A.H Ab-Rahman, Z.Md-Yusof 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
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
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