




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
n
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
n
n
n
n
n
n
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
g p , ,
would be written as:
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
would be written as:
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
A digit in base R can range from 0 to R 1
BINARY OCTAL DECIMAL HEXADECIMAL (Base 2) (Base 8) (Base 10) (Base 16)
0 0 - 000 0 - 0000 0 - 0000 A - 1010 1 1 - 001 1 - 0001 1 - 0001 B - 1011 2 - 010 2 - 0010 2 - 0010 C - 1100 3 - 011 3 - 0011 3 - 0011 D - 1101 4 - 100 4 - 0100 4 - 0100 E - 1110 5 - 101 5 - 0101 5 - 0101 F - 1111 6 - 110 6 - 0110 6 - 0110 7 111 7 0111 7 0111
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
7 - 111 7 - 0111 7 - 0111 8 - 1000 8 - 1000 9 - 1001 9 - 1001
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
0110 1011 0111 6 B 7
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
A 1 9 1010 0001 1001
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
The rules for binary arithmetic are:
The rules for binary subtraction are:
0 + 0 = 0, carry = 0 1 + 0 = 1, carry = 0 0 + 1 = 1, carry = 0
1 + 1 = 0, carry = 1
0 - 0 = 0, borrow = 0 1 - 0 = 1, borrow = 0 0 - 1 = 1, borrow = 1
1 - 1 = 0, borrow = 0
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Borrows, Carries from digits to left of current of digit.
Binary subtraction, addition works just the same as decimal addition, subtraction.
Decimal 0b 101011 0b 000001
Binary
from LSD to MSD: 7+4 = 1; with carry out of 1 to next column
101100 From LSB to MSB: 1+1 = 0, carry of 1 1 (carry)+1+0 = 0, carry of 1 1 (carry)+0 + 0 = 1 no carry
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
to next column
1 (carry) + 3 + 1 = 5. answer = 51.
1 (carry)+0 + 0 = 1, no carry 1 +0 = 1 0 + 0 = 0 1 + 0 = 1 answer = % 101100
Decimal
900
Binary
0b 100
899 0-1 = 9; with borrow of 1 from next column 0 1 (b ) 0 9 ith
011 0-1 = 1; with borrow of 1 from next column
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
0 -1 (borrow) - 0 = 9, with borrow of 1 9 - 1 (borrow) - 0 = 8. Answer = 899.
0 -1 (borrow) - 0 = 1, with borrow of 1 1 - 1 (borrow) - 0 = 0. Answer = % 011.
0x3A 0 28
0x3A = 3 * 16 + 10
Decimal check.
0x
A+8 = 2; with carry out of 1 to next column
0x28 = 2 * 16 + 8 = 40 58 + 40 = 98
0x62 = 6 * 16 + 2
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
1 (carry) + 3 + 2 = 6. answer = 0x
0x62 6 16 + 2 = 96 + 2 = 98!!
Why is 0x4 – 0x7 = 0xD with a borrow of 1?
The borrow has a weight equal to the BASE (in this case 16).
BORROW +0x4 – 0x7 = 16 + 4 - 7 = 20 - 7 = 13 = 0xD.
0xD is the result of the subtraction with the borrow
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
0xD is the result of the subtraction with the borrow.
Exactly the same thing happens in decimal. 3 - 8 = 5 with borrow of 1 borrow + 3 - 8 = 10 + 3 - 8 = 13 - 8 = 5.
In this class I will use 8 bit precision most of the time, 16 bit occasionally.
Overflow occurs when I add or subtract two numbers, and the correct result is a number that is outside of the range of allowable numbers for that precision. I can have both unsigned and signed overflow (more on signed numbers later)
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
8 bits -- unsigned integers 0 to 2 8 -1 or 0 to 255
16 bits -- unsigned integers 0 to 2^16 -1 or 0 to 65535
Assume 8 bit precision; i.e. I can’t store any more than 8 bits for each number. LetsLets addadd 255 + 1 = 256. 255 1 256. The number 256 is OUTSIDE the rangeThe number 256 is OUTSIDE the range of 0 to 255! What happens during the addition?
255 = 0x FF
256 /= 0x00 /= means Not Equal
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
0xF + 1 = 0, carry out 0xF + 1 (carry) + 0 = 0, carry out Carry out of MSB falls off end, No place to put it!!! Final answer is WRONG because could not store carry out.
A carry out of the Most Significant Digit (MSD) or Most Significant Bit (MSB) is an OVERFLOW indicator forg ( ) addition of UNSIGNED numbers. The correct result has overflowed the number range for that precision, and thus the result is incorrect. If we could STORE the carry out of the MSD, then the answer would be correct. But we are assuming it is f f
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
discarded because of fixed precision, so the bits we have left are the incorrect answer.
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Vdd High True Vdd switch
Vdd is power supply voltage, typically 5V or 3 3V
L H
Gnd is 0 V
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Gnd Gnd
Switch open ( negated ) , output is L
Switch closed ( asserted ), output is H
Vdd Vdd Low True switch
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Gnd Gnd
Switch open (negated), output is H
Switch closed (asserted), output is L
S: source G: gate
D: drain
transistor operation of P, N types is
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Copyright 2005. Thomson/Delmar Learning, All rightsreserved.
yp complementary to each other
x 1 x 2 x
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
xn
x 1 x 2^ x^1 ^ x^2 x^1 ^ x^2 ^ ^ xn
AND gates
x 1 xx 2
xn
x x (^1) x 1 + x 2 + + xn 2
x 1 + x 2
OR gates
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
x x
NOT gate
x 1 x 2 x 3^ f^ = x^1 + x^2 ^ x^3
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
x 1
x 2
1 1 0 0
f 0 0 0 1
1 1 0 1
0 0 1 1
0 1 0 1
A
B
Electrical & Computer Engineering – Microcomputers Dr. Jeff Jackson Lecture 1-
Network that implements f = x 1 + x 1 x 2