Introduction To Microprocessor Systems: Basic of Digital Electronics
Introduction To Microprocessor Systems: Basic of Digital Electronics
Systems
1
Digital Electronics
2
Digital Devices
Most computers today are composed of digital
devices.
Process electrical signals.
Can only have two states.
States are:
A high level of voltage: 5V DC
A low level of voltage: 0V DC
3
Digital Devices
PCs are digital electronic systems.
PCs process data in digital format.
4
BINARY LANGUAGE AND LOGIC
5
Two bits can represent 22 = 4 different
combinations.
Any number, letter, or symbol can be
described by organizing a group of related
bits into coded bit patterns called words.
A bit is a basic unit of information.
A nibble is a group of 4 bits and can
represent 16 things.
A byte is a group of 8 bits and can represent
256 things.
6
Binary Numbers
0 1 1 0
bit
0ff on on off
7
Data types
byte: 8 bits:
10010101
word: 16 bits or __
2 bytes:
1110101101100010
double word: 32 4 bytes :
__ bits or __
11010110111001011101011011001011
quad word: 64 8 bytes:
__ bits or __
01011110110101011101010011001011
11110110110001011101011011001101
8
Range of a unsigned number
1 bit? 0 ~ 1 2 1
1
2 bits? 0 ~ 3 2 1
2
4 bits? 0 ~ 15 2 1 4
n bit? 0 ~ ( 2 1) n
9
Range of the data types
Unsigned integers:
byte: 0 to 28 - 1 = 255
word: 0 to 216 - 1 = 64k - 1 = 65,535
double word: 0 to 232 - 1
quad word: 0 to 264 - 1
10
Numbering Systems
11
Numbering Systems
12
Number systems (bases)
13
Number systems (bases) Example
Format Value
14
Addition & Multiplication
Examples:
1001100b 1110b
+ 1101011b * 1101b
10110111 10110110
10110101b 111101b
+ 1101101b * 1111b
100100010 1110010011
15
Converting to decimal
Binary to Decimal
1010b =1 * 23 + 0 * 22 + 1 * 21 + 0*100
=10
Hex to Decimal
ABCh = 10 * 162 + 11 * 161+ 12 * 160
= 10 * 256 + 11 * 16 + 12 * 1
= 2560 + 176 + 12
= 2748
16
Converting to decimal
Octal to Decimal
256o = 2 * 82 + 5 * 81+ 6 * 80 =174
Conclusion:
(Number)n
= (multiply each digit by an integer power of n)
17
Conversion from decimal
Decimal integer to Binary
quotient remainder
54 = 27 * 2+ 0
27 = 13 * 2 + 1
13 = 6 * 2 +1
6=3*2+0
3=1*2+1
1=0*2+1
110110 18
Conversion from decimal
66o
19
Conversion from decimal
Decimal fraction to Binary (Octal, Hex)
integer
(0. 6 8 7 5)10 = (0.1011)2
X 2
1.3750
X 2
0.7500
X 2
1.5000
X 2
1.0000
0.1 0 1 1 20
Signed numbers
Signed numbers: The number of bits must be
fixed. In every case, the highest bit is the
sign bit.
0 means +
1 means -
Example:
22
Range of signed numbers
Two's complement: Sizes
Signed byte: -128 to +127 = 27 - 1
Signed word: -32,768 to +32,767 = 215 - 1
Singed double word:
-2,147,483,648 to +2,147,483,647 = 231 - 1
Comments:
There is one more negative than positive value
There are (about) half as many positive signed
values as unsigned values
23
Addition & Subtraction (signed)
24
Addition & Subtraction (signed)
Two's complement:
Addition
1) add two numbers including their sign bits
Example:
+6 00000110 -6 11111010
+ 13 0 0 0 0 1 1 0 1 - 13 1 1 1 1 0 0 1 1
+ 19 0 0 0 1 0 0 1 1 - 19 1 1 1 0 1 1 0 1
25
Addition & Subtraction (signed)
Subtraction
6 00000110 13 0 0 0 0 1 1 0 1
- 13 1 1 1 1 0 0 1 1 -6 11111010
-7 11111001 +7 00000111
26
Character Storage
27