Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Decimal Numbers-Digital Electronics I- Lecture 04 Slides-Electronics and Communication Engineering, Slides of Digital Electronics

Decimal Numbers, Binary Numbers, Decimal to Binary Conversion, Binary Arithmetic, 1’s Complement, 2’s Complement, Binary Numbers, Signed Numbers, Arithmetic Operations, Signed Numbers, Hexadecimal Numbers, Octal Numbers, Binary Coded Numbers, BCD, Digital Codes, Error Detection, Correction Codes, Alphanumeric, ASCII

Typology: Slides

2011/2012

Uploaded on 02/17/2012

minh
minh 🇲🇾

4.4

(14)

12 documents

1 / 40

Toggle sidebar

Related documents


Partial preview of the text

Download Decimal Numbers-Digital Electronics I- Lecture 04 Slides-Electronics and Communication Engineering and more Slides Digital Electronics in PDF only on Docsity! EEE130 Digital Electronics I Lecture #2 -Number Systems, Operations and Codes- By Dr. Shahrel A. Suandi Topics to be discussed • 2-1 Decimal Numbers • 2-2 Binary Numbers • 2-3 Decimal-to-Binary Conversion • 2-4 Binary Arithmetic • 2-5 1’s and 2’s Complements of Binary Numbers • 2-6 Signed Numbers • 2-7 Arithmetic Operations with Signed Numbers • 2-8 Hexadecimal Numbers • 2-9 Octal Numbers • 2-10 Binary Coded Numbers (BCD) • 2-11 Digital Codes • 2-12 Error Detection and Correction Codes What is the meaning of weighted number system?? • As mentioned before, each number will be multiplied by its weight to get the actual number • Example: – Let’s consider 23 (in decimal number) or, in words twenty three 2 3 23 2£101 3£100 2 3 23 101100 2-2 Binary Numbers • These types of numbers have only two digits: 1 and 0 (bits) • Therefore, it is less complicated compared to decimal numbers • The base is two and written as • In general, with bits we can count up to a number equal to (0011)2 = 310 n 2n¡1 Application using binary numbers • A counting system that counts tennis ball Converting Decimal Fractions to Binary • There are two methods: – Sum-of-weights • – Repeated multiplication by 2 • Let’s look at page 56 0:625 = 0:5+0:125 = 2¡1+2¡3 = 0:101 2-4 Binary Arithmetic • There are 4 arithmetic operations using binary – Binary addition – Binary subtraction – Binary multiplication – Binary division • All arithmetic operations follow the same procedure as decimal numbers have – carry, borrow, partial products 2-5 1’s and 2’s Complements of Binary Numbers • These complements of binary numbers are important because they permit the representation of negative numbers • How to find 1’s complement? – By changing all 1s to 0s and all 0s to 1s • How to find 2’s complement? – By changing all 1s to 0s and all 0s to 1s, then add 1 to the LSB – Alternative method to find 2’s complement • Start with LSB and write the bits as they are up to and including the first 1 • Take the 1’s complements of the remaining bits 2-6 Signed Numbers (1) • The sign bit – The left-most bit in a signed binary number is the sign bit, which tells us whether the number is positive or negative • 0: positive, 1: negative • Sign-magnitude form – The magnitude bits are the remaining bits after the sign-bit 00011001 Sign bit Magnitude bits Signed numbers (2) • 1’s complement form – In the 1’s complement form, a negative number is the 1’s complement of the corresponding positive number • 2’s complement form – In the 2’s complement form, a negative number is the 2’s complement of the corresponding positive number • The decimal value of signed numbers – Sign-magnitude – 1’s complement – 2’s complement Signed Numbers (3) • Range of Signed Integer Numbers That Can be Represented – 8 bit = 1 Byte – With one byte or eight bits, 256 different numbers can be represented. How about 16 bits and 32 bits?? More numbers can be used – To know the total of combinations of n bits: • Total combinations = • The range of values for n-bit numbers is 2n ¡(2n¡1)to(2n¡1¡1) Subtraction of signed numbers • Subtraction is a special case of addition – change the sign of the subtrahend and adds it to the minuend • What is subtrahend and minuend? – Subtrahend – the amount/quantity to be subtracted (book example: 6) – Minuend – the amount/quantity to be subtracted from (book example: 9) • Big hints: – To subtract two signed number, take the 2’s complement of the subtrahend and add. Discard any final carry bit Multiplication of signed numbers • Numbers involved in a multiplication are multiplicand, multiplier and product • Performing multiplication using addition: – Direct addition and partial products • When two binary numbers are multiplied, both numbers must be in true (uncompleted) form • Look at example 2-22 for more details on this operation Division of signed numbers • Numbers involved in a division are dividend, divisor and quotient • Division can also be performed using an adder – due to division is accomplished using subtraction in computers, and as division is also using adder, division can also be performed with an adder • The operation stops when the quotient is 0 P Subtract from ! - comment 2’s complement Hexadecimal . in hexadecimal A - maximum plus 1 in hexadecimal 7 Example: Method 1 A FF-2A LH D5+1 D6 2’s complement in hexadecimal Me Hexadecimal Binary : 2's ao Method 2 Example: 2A : 00101010 : 11010110 D6 a 1's complement . . | 0123456789ABCDEF ! i 2's complement exeteciel FEDCBA9876543210 ia Se in hexadecimal Method 3 Example: DS+1 D6 7] 2-9 Octal Numbers • This number is composed of eight digits; 0-7 • Octal-to-decimal conversion – Similar to others • Decimal-to-octal conversion – Using this following technique • Binary-to-octal conversion – Quite similar with binary-to-hexadecimal conversion – If there are not enough bit (for the most left bit), add 1 or 2 zeros as 0s will never affect the binary numbers 2-10 Binary Coded Decimal (BCD) • BCD is a way to express each of the decimal digits with a binary code – There are only 10 groups in BCD system • 8421 Code – This is a type of BCD code which indicates the binary weights – BCD 8421 code • Invalid codes – these are the codes that are not used in BCD (remember that BCD is a 10 groups number AND NOT 16), so A to F are not included • BCD addition – carefully do this as there are valid and invalid answers – For invalid answers, just add 6 to them Alphanumeric • Alphanumeric codes are codes that represent numbers and alphabetic characters (letters) • Consists of 10 decimal digits and 26 letters of the alphabet • Bits required is 6 bits  in binary then we need more than which is – The remaining 28 bits are used for other purposes like periods, colons, semicolons, etc. 25 = 32 26 = 64 ASCII • Stands for “American Standard Code for Information Interchange” • Has 128 characters and symbols – Represented in 7-bit binary code – First 32 ASCII characters are used for control purposes, like “null”, “line fee”, etc. • Extended ASCII characters – Used for other than English language (additional of 128 characters) – Adopted by IBM to be used in PCs 2-12 Error Detection and Correction Codes • We can detect a single bit error, or detect and correct a single bit error • How to do this?? – By performing parity check • Parity method for error detection – Parity bit is used in many systems as a means for bit error detection – Attached at the beginning or end of the code – Parity, which is odd or even, is assigned to a group of bits for error detection purpose • Note here that parity is either odd or even • Odd – total number of 1s is odd, and vice versa to even – Detecting an error • By using odd or even information. Let’s try it EXAMPLE Determine the Hamming code for the BCD number 1001 (data bits), using even parity. Solution Step 1: Find the number of parity bits required. Let p = 3. Then P=B=8 d+p+1=4+3+1=8 Three parity bits are sufficient. Total code bits = 4+ 3=7 Step 2: Construct a bit position table, as shown in Table 2-12, and enter the data bits. Parity bits are determined in the following steps. TABLE 2-12 BIT DESIGNATION BIT POSITION BINARY POSITION NUMBER D 7S Ose | EE ir 110 | 111 a a D, | P D 5 iabaaalaniaise Step 3: Determine the parity bits as follows: Bit P, checks bit positions 1, 3, 5, and 7 and must be a 0 for there to be an even number of Is (2) in this group. Bit P, checks bit positions 2. 3, 6, and 7 and must be a O for there to be an even number of Is (2) in this group. Bit P; checks bit posi even number of Is (2 ions 4, 5, 6, and 7 and must be a | for there to be an n this group. Step 4: These parity bits are entered in Table 2-12, and the resulting combined code is 0011001. Related Problem Determine the Hamming code for the BCD number 1000 using even parity. fexamece 2-42 Determine the Hamming code for the data bits 10110 using odd parity. Solution Step 1: Determine the number of parity bits required. In this case the number of data bits, d, is five. From the previous example we know that p = 3 will not work. Try p z 2? = 2*= 16 dt+p+1=5 Four parity bits are sufficient. Total code bits = 5+4=9 Step 2: Construct a bit position table, Table 2-13, and enter the data bits. Parity bits are determined in the following steps. Notice that P, is in bit position 8. TABLE 2-13 BIT DESIGNATION BIT POSITION BINARY POSITION NUMBER ee a haa) Step 3: Determine the parity bits as follows: Bit P, checks bit positions 1, 3, 5, 7, and 9 and must be a | for there to be an odd number of Is (3) in this group. Bit P, checks bit positions 2, 3, 6, and 7 and must be a O for there to be an odd number of Is (3) in this group. Bit P, checks bit positions 4, 5, 6, and 7 and must be a | for there to be an odd number of Is (3) in this group. Bit P, checks bit positions 8 and 9 and must be a 1 for there to be an odd number of Is (1) in this group. Step 4: These parity bits are entered in the Table 2—13, and the resulting combined code is 101101110. Related Problem Determine the Hamming code for 11001 using odd parity. Detecting and Correcting an Error with the Hamming Code • Let’s look at the example
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved