Digital Logic - Unit 1 Part2
Digital Logic - Unit 1 Part2
▪ DIGITAL COMPUTERS
▪ NUMBER SYSTEMS
▪ DECIMAL ,BINARY ,OCTAL,HEXADECIMAL
▪ MUTUAL CONVERSIONS
▪ WEIGHTED STRUCTURE OF BINARY SYSTEM
▪ COMPLEMENTS – 1’S AND 2’S ,9’S AND 10’S,7’s and 8’s,15’s and
16’s
▪ SIGNED NUMBERS
▪ ADDITION AND SUBTRACTION WITH SIGNED NUMBERS
TO BE DISCUSSED
▪ BCD NUMBERS
▪ BCD ADDITION
▪ BCD SUBTRACTION
▪ GRAY CODE
▪ BINARY TO GRAY CODE CONVERSION
▪ GRAY TO BINARY CODE CONVERSION
▪ WEIGHTED CODE – 8421
▪ NON-WEIGHTED CODE – ASCII AND EBCDIC
BCD NUMBERS
▪ Binary number system is the most natural system for a computer.
▪ Rather than converting the whole number into binary, BCD splits the
number up into its digits and converts each digit to 4-bit binary.
BCD NUMBERS
BCD NUMBERS
▪ EX:
▪ 3 4 5 - Decimal
▪ 0011 0100 0101 - BCD
NOTE:
▪ A number with k decimal digits will require 4k bits in BCD.
▪ Each group of 4 bits represents one decimal digit.
▪ (185)10 =
▪ (0001 1000 0101)BCD = (10111001)2
BCD NUMBERS
BCD NUMBERS
NOTE:
▪ BCD numbers are decimal numbers and not binary numbers, although they
use bits in their representation.
▪ the binary combinations 1010 through 1111 are not used and have no
meaning in BCD
▪ decimal number are written with the symbols 0, 1, 2, 3 …9 and BCD numbers
use the binary code 0000, 0001, 0010, …, 1001.
▪ CASE 2:
If the sum of the addition is greater than 9, invalid BCD sum
BCD ADDITION
▪ SOLUTION FOR CASE 2:
▪ ADD 6 (0110) to the BCD sum
▪ If not add 0110(6) to the sum and add the carry if any to next digit
Rules :
■ MSB of Gray code is same as MSB of Binary
■ Coding from left to right
■ Add each adjacent pair of bits to get the next bit of Gray code
■ Omit the carry if it occurs
● Ex:
(1011)2 → (1110)G
(101101)2 → (111011)G
Gray Code
● Conversion from Gray to Binary code
Rules :
■ MSB of Gray code is same as MSB of Binary
■ Coding from left to right
■ Add the binary digit generated to the adjacent Gray bit to get
the next bit
■ Omit the carry if it occurs
● Ex:
(1110)G → (1011)2
(111011)G → (101101)2
Homework
● Try these
Write (25)10 in binary and Gray code
Write (37)10 in BCD and Excess 3 code
ASCII
● Its a non-weighted code
○ backspace (BS)
○ horizontal tabulation (HT),
○ and carriage return (CR).
ASCII
● Information separators