Unit3 - Number Conversion and Codes (1) Class
Unit3 - Number Conversion and Codes (1) Class
Octal to Decimal
(2754)8 (2 83 ) (7 82 ) (5 81 ) (4 8 4 )
1024 448 40 4
151610
Hexadecimal to Decimal
(54.D 2)16 (5 161 ) (4 16 0 ) (13 16 1 ) (2 16 2 )
80 4 0.8125 0.0078125
84.8203125
Binary to Octal
Step 1 − Divide the binary digits into groups of three (starting from the right).
Step 2 − Convert each group of three binary digits to one octal digit.
Octal to Binary
Hexadecimal to Binary
Step 1 − Convert each hexadecimal digit to a 4 digit binary number.
Step 2 − Combine all the resulting binary groups (4 digits each) into a single binary number.
8 4 21
(1101) 2 8 4 1 (13)10
(0111) 2 710
(1010) 2 (10)10 A16
(10101) 2
Practice Question
(4021.5)5 (__________)10
( B65 F )16 (__________)10
(630.4)8 (___________)10
(0.6875)10 (_____________) 2
(0.513)10 (____________)8
(306.D)16 (___________)8
(10110001101011.11110010) 2 (__________)16
(108)10 (_____)16
(___________) 2 (_______)10 (576)8 (______)16
BCD (Binary Coded Decimal)
• Do not get confused, BCD is not the same as hexadecimal.
• Main advantage of BCD - Easy conversion between decimal and binary form.
• BCD code is often called 8421 because the BCD is a weighted code.
• However, disadvantage - BCD code is wasteful as the states
between 1010 (decimal 10), and 1111 (decimal 15) are not used.
Steps:
• Find the decimal equivalent of the given binary number.
• Add +3 to each digit of decimal number.
• Convert the newly obtained decimal number back to binary number to get required
excess-3 equivalent.
Gray Code (Cyclic Code, or Reflected Binary Code )
• Ordering of the binary number system such that each incremental value can only differ
by one bit.
• Gray code is non weighted that means it does not depends on positional value of digit.
• it is not suitable for arithmetic operations.
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (which is 0 carry 1)
(10010) 2 (1001) 2 ?
Binary Subtraction
(1100) 2 (1010) 2 ?