Digital Logic & Design Adil Waheed Lecture 03
Range of Binary Numbers Processors can handle 64-bit unsigned binary values. Maximum unsigned decimal number is x How to represent larger numbers? How to represent very small numbers? How to represent numbers with integer part and fraction part?
Hexadecimal Number System Base 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Representing Binary in compact form = 1B06 H
Counting in Hexadecimal DecimalBinaryHexadecimalDecimalBinaryHexadecimal A B C D E F
Binary-Hexadecimal Conversion Binary to Hexadecimal Conversion D 6 B 9 6 Hexadecimal to Binary Conversion FD
Decimal-Hexadecimal Conversion Decimal to Hexadecimal Conversion Indirect Method Decimal →Binary → Hexadecimal Repeated Division by 16
Decimal-Hexadecimal Conversion Hexadecimal to Decimal Conversion Indirect Method Hexadecimal →Binary → Decimal Sum-of-Weights
Hexadecimal Addition & Subtraction Hexadecimal Addition Carry generated Hexadecimal Subtraction Borrow weight 16
Repeated Division by 16 NumberQuotientRemainder
Sum-of-Weights CA02 (C x 16 3 ) + (A x 16 2 ) + (0 x 16 1 ) + (2 x 16 0 ) (12 x 16 3 ) + (10 x 16 2 ) + (0 x 16 1 ) + (2 x 16 0 ) (12 x 4096) + (10 x 256) + (0 x 16) + (2 x 1)
Hexadecimal Addition Carry 1 2AC66+5=11d Bh + 92B5C+B=23d 17h BD7BA+2+1=13d Dh 2+9=11d Bh
Hexadecimal Subtraction Borrow B521-6=15d Fh - 2AC626-C=14d Eh 67EF17-A=7d 7h 8-2=6d 6h
Octal Number System Base 8 0, 1, 2, 3, 4, 5, 6, 7 Representing Binary in compact form =
Counting in Octal DecimalBinaryOctal
Counting in Octal DecimalOctalDecimalOctalDecimalOctal
Binary-Octal Conversion Binary to Octal Conversion Octal to Binary Conversion
Decimal-Octal Conversion Decimal to Octal Conversion Indirect Method Decimal →Binary → Octal Repeated Division by 8
Decimal-Octal Conversion Octal to Decimal Conversion Indirect Method Octal →Binary → Decimal Sum-of-Weights
Octal Addition & Subtraction Octal Addition Carry generated Octal Subtraction Borrow weight 8
Repeated Division by 8 NumberQuotientRemainder (O 0 ) (O 1 ) 840 (O 2 ) 404 (O 3 )
Sum-of-Weights 4033 (4 x 8 3 ) + (0 x 8 2 ) + (3 x 8 1 ) + (3 x 8 0 ) (4 x 512) + (0 x 64) + (3 x 8) + (3 x 1)
Octal Addition Carry =3d 3O =7d 7O =13d 15O 1+7+5=13d 15O
Octal Subtraction Borrow =1d 1O =1d 1O =6d 6O 6-5=1d 1O
Alternate Representations BCD Code BCD Addition Gray Code
Alternate Representations BCD (Binary Coded Decimal) Code DecimalBCDDecimalBCD
BCD Addition Multi-digit BCD numbers can be added together is illegal BCD number
BCD Addition Add a 0110 (6) to an invalid BCD number Carry added to the most significant BCD digit
Alphanumeric Code Numbers, Characters, Symbols ASCII 7-bit Code American Standard Code for Information Interchange 10 Numbers (0-9) 26 Lower Case Characters (a-z) 26 Upper Case Characters (A-Z) Punctuation and Symbols
ASCII Code Numbers 0 to 9 ASCII (30h) to (39h) Alphabets a to z ASCII (61h) to (7Ah) Alphabets A to Z ASCII (41h) to (5Ah) Control Characters ASCII (0h) to (1Fh)
Error Detection Digital Systems are very Reliable Errors during storage or transmission Parity Bit Even Parity Odd Parity
parity Odd parity: The number of 1-bit must add up to an odd number Even parity: The number of 1-bit must add up to an even number
Summary Hexadecimal Number System Binary-Hexadecimal Conversion Decimal-Hexadecimal Conversion Octal Number System Binary-Octal Conversion Decimal-Octal Conversion
Summary Alternate Representations BCD Code Gray Code Alphanumeric Codes ASCII Error Detection Parity Bit