490 likes | 851 Views
By: Safwan Mawlood. Digital Logic. Digital Principles and Logic Design, A.Saha & N.Manna. Number Systems. Number Systems. Knowing what base someone refers to Decimal uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 . Binary uses 2 digits: 0 and 1 .
E N D
By: Safwan Mawlood Digital Logic Digital Principles and Logic Design, A.Saha&N.Manna Number Systems
Number Systems • Knowing what base someone refers to • Decimal uses 10 digits: 0,1, 2, 3, 4, 5, 6, 7, 8, 9. • Binary uses 2 digits: 0 and 1. • Octal number system there are 8 digits—0, 1, 2, 3, 4, 5, 6, and 7. • Hexadecimal number system has 16 digits—0 to 9— and the rest of the six digits are specifies by letter symbols as A,B, C, D, E, and F. Here A, B, C, D, E, and F represent decimal 10, 11, 12, 13, 14, and 15 respectively.
Hexadecimal • The base16, or hexadecimal (hex), number system is used frequently when working with computers, because it can be used to represent binary numbers in a more readable form.
CONVERSION BETWEEN NUMBER SYSTEMS • It is often required to convert a number in a particular number system to any other number system, e.g., it may be required to convert a decimal number to binary or octal or hexadecimal.
Converting Decimal to Binary To convert a number in decimal to a number in binary we have to divide the decimal number by 2 repeatedly, until the quotient of zero is obtained.
Converting Decimal to Binary Start by dividing the decimal by the largest number in the Value row that will go.
Decimal to Octal Conversion Similarly, to convert a number in decimal to a number in octal we have to divide the decimal number by 8 repeatedly, until the quotient of zero is obtained.
Decimal-to-hexadecimal Conversion The same steps are repeated to convert a number in decimal to a number in hexadecimal. Only here we have to divide the decimal number by 16 repeatedly, until the quotient of zero is obtained.
Binary numbers are converted to decimal numbers by multiplying the binary digits by the base number of the system, which is base 2, and raised to the exponent of its position. Converting 8-Bit Binary to Decimal
Octal-to-Decimal Conversion • Ex. Convert 34628 into decimal number. • Sol. The octal number given is 3462
Hexadecimal-to-decimal Conversion • Ex. Convert 42AD 16 to decimal
Fractional Conversion • Example: Convert 1010.011 into decimal number
Octal-to-decimal Conversion • Example: Convert 362.358 into a decimal number.
Hexadecimal to Decimal number Example: 42A.1216
-decimal-to-binary Conversion Example: 25.62510
Convert Decimal to octal number • Convert 34.52510 into an octal number.
Binary Arithmetic • Binary Addition
Example: Add 10102 and 11012 • Example: Add 01102 and 11112
Example: Multiply the following binary numbers 01112 and 11012
Example: Multiply the following binary numbers 1.0112 and 10.012
1’s Complement • The ones' complement of a binary number is defined as the value obtained by inverting all the bits in the binary representation of the number (swapping 0's for 1's and vice-versa).
Subtraction Using 2’s Complement • Binary subtraction can be performed by adding the 2’s complement of the subtrahend to the minuend. If a carry is generated, discard the carry. Now if the subtrahend is larger than the minuend, then no carry is generated
Code • Computers and other digital circuits process data in binary format. Various binary codes are used to represent data which may be numeric, alphabetic or special characters. Codes are also used for error detection and error correction in digital systems.
Gray • Gray code belongs to a class of code known as minimum change code, in which a number changes by only one bit as it proceeds from one number to the next.
Conversion of a Binary Number into Gray Code (101011)2 change to Gray
Binary Code Decimal • BCD, is a method of using binary digits to represent the decimal digits 0 through 9. A decimal digit is represented by four binary digits, or four bits are required to code each decimal number. as shown below:
You must realize that BCD and binary are not the same. For example, 4910 in binary is 1100012, but 4910 in BCD is 0100 1001BCD. Each decimal digit is converted to its binary equivalent.
BCD Conversion • For example, let's go through the conversion of 26410 to BCD. We'll use the block format that you used in earlier conversions. First, write out the decimal number to be converted; then, below each digit write the BCD equivalent of that digit: