# Arithmetic Circuits Fundamentals Of Logic Design ```Introduction to
Microprocessors
Number Systems and
Conversions
Chapter 1: Introduction to 68HC11
The 68HC11 Microcontroller
No. 1-1 9/6/00
Introduction to
Microprocessors
Number Systems and
Conversions
What is a computer?
Software
Hardware
Computer Hardware Organization
Control
unit
common bus
Arithmetic
logic
unit
memory
Registers
program
data
storage
storage
output
input
unit
unit
Figure 1.1 Computer hardware organization
No. 1-2 9/6/00
The processor
Introduction to
Microprocessors
Number Systems and
Conversions
Registers -- storage locations in the processor
Arithmetic logic unit
Control unit
program counter keeps track of the address of the next instruction to be executed
status register flags the instruction execution result
The microprocessor
A processor implemented on a very large scale integration (VLSI) chip
Peripheral chips are needed to construct a product
The Microcontroller
The processor and peripheral functions implemented on one VLSI chip
No. 1-3 9/6/00
Introduction to
Microprocessors
Number Systems and
Conversions
Features of the 68HC11A8 microcontroller
-
8-bit CPU
-
256 bytes SRAM
-
512 bytes EEPROM
-
8 KB ROM
-
3 input capture channels
-
5 output compare functions
-
one 8-bit pulse accumulator
-
one serial communication interface (SCI)
-
one serial peripheral interface (SPI)
-
real-time interrupt (RTI) circuit
-
8-channel 8-bit A/D converter
-
computer operate properly (COP) watchdog system
No. 1-4 9/6/00
P ULSE ACCUMULAT OR
O
C
1
RAM-256 bytes
P ERIODIC INT ERRUP T
EEPROM-512 bytes
COP WAT CHDOG
P E7
P E6
P E5
P E4
P E3
P E2
P E1
P E0
SS
SCK
MOSI
SPI
PORT
E
MISO
A/D
CONVERTER
T xD
SCI
RxD
VREFH
VREFL
P A0
P ORT
D
P D5
P D4
P D3
P D2
P D1
P D0
INTERRUPTS
IRQ
HANDSHAKE I/O
(VPPBULK )
DAT A DIRECT ION C
XT AL
EXT AL
P A2
P A1
M68HC11 CPU
RESET
XIRQ
A
DATA DIRECTION
ROM-8KB
Introduction to
P A7
Microprocessors
P A6
NumberP A5Systems and
P A4
PORT
Conversions
P A3
P AI
OC2
OC3
OC4
OC5
IC1
IC2
IC3
OSCILLATOR
PORT B
PORT C
P ARALLEL
I/O
E
MODA
LIR
MODB
(VSTBY)
VDD
VSS
MODE
SELECT
POWER
P P P P P P P P
B B B B B B B B
7 6 5 4 3 2 1 0
P P P P P P P P S S
C C C C C C C C T T
7 6 5 4 3 2 1 0 R R
B A
AA AA AA AA A A AA AA AA
1 1 1 1 1 1 9 8 D D DD DD DD
5 4 3 2 1 0
7 6 5 4 3 2 1 0
R/W AS
Figure 1.2 68HC11A8 block diagram (redrawn with permission of Motorola)
SINGLE
CHIP
EXP AND
No. 1-5 9/6/00
Introduction to
Microprocessors
Number Systems and
Conversions
Examples of microcontroller applications
-
Displays
Printers
Keyboards
Modems
Charge card phones
Refrigerators
Washing machines
Microwave ovens
Automobile engine fuel injection
Fax machines
Motor speed control
etc.
No. 1-6 9/6/00
Semiconductor memory
Introduction to
Microprocessors
Number Systems and
Conversions
- Random-access memory (RAM): same amount of time
-
is required to access any location on the same chip
written by the processor
Random-access memory
- Dynamic random-access memory (DRAM): periodic
-
refresh is required to maintain the contents of a DRAM chip
Static random-access memory (SRAM): no periodic
refresh is required
programmed when being manufactured
- Programmable read-only memory (PROM): the memory
chip can be programmed by the end user
No. 1-7 9/6/00
-
Erasable programmable ROM (EPROM)
Introduction to
Microprocessors
Number Systems and
Conversions
1. electrically programmable many times
2. erased by ultraviolet light (through a window)
3. erasable in bulk (whole chip in one erasure operation)
-
Electrically erasable programmable ROM (EEPROM)
1. electrically programmable many times
2. electrically erasable many times
3. can be erased one location, one row, or whole chip in one operation
-
Flash memory
1. electrically programmable many times
2. electrically erasable many times
3. can only be erased in bulk
No. 1-8 9/6/00
Computer software
-
Introduction to
Microprocessors
Number Systems and
Conversions
Computer programs are known as software
A program is a sequence of instructions
Machine instruction
-
A sequence of binary digits which can be executed by the processor
Hard to understand for human being
Assembly language
-
Defined by assembly instructions
An assembly instruction is a mnemonic representation of a machine
instruction
Assembly programs must be translated before it can be executed -translated by an assembler
No. 1-9 9/6/00
High-level language
-
Introduction to
Microprocessors
Number Systems and
Conversions
Syntax of a high-level language is similar to English
A translator is required to translate the program written in a
high-level language -- done by a compiler
Source code
-
A program written in assembly or high-level language
Object code
-
The output of an assembler or compiler
No. 1-10 9/6/00
Introduction to
Microprocessors
Number Systems and
Conversions
7
Accumulator A
0 7
Accumulator B
0 A:B
15
Double Accumulator D
0 D
15
Index Register IX
0 IX
15
Index Register IY
0 IY
15
Stack pointer
0 SP
15
Program Counter
0 PC
S
X
H
I
N
Z
V
C CCR
Carry
Overflow
Zero
Negative
Half-Carry (from bit 3)
Stop Disable
Figure 1.3 MC68HC11 Programmer's model
No. 1-11 9/6/00
Introduction to
Microprocessors
Number Systems and
Conversions
A memory location has 2 components: address and contents
contents
Data transfer between CPU and memory involves address
bus and data bus
CPU
memory
data bus lines
Figure 1.5 Data transfer between CPU and memory
No. 1-12 9/6/00
Introduction to
Microprocessors
Number Systems and
Conversions
NUMBER SYSTEMS,
CONVERSIONS
and
CODES
No. 1-13 9/6/00
Goals
Upon Completion
Introduction to
Microprocessors
Number Systems and
Conversions
• Understand Positional Number Systems
• Convert from one base to another
• Add, Subtract using Binary Numbers
No. 1-14 9/6/00
Chapter Overview
Introduction to
Microprocessors
Number Systems and
Conversions
• Binary Number Representation
Sign &amp; Magnitude
Ones Complement
Twos Complement
• Codes
Using Ones and Twos Complement
Using BCD Nines and Tens Complement
• Binary Subtraction
No. 1-15 9/6/00
Binary Weights
Introduction to
Microprocessors
Number Systems and
Conversions
• In Base 10 the weights in positional notation are:
a0 is units weight
a1 is 10 units weight
a2 is 100 units weight or 10 * a1 weight
...
• In Base 2 the weights in positional notation are:
a0 is units weight
a1 is 2 units weight
a2 is 4 units weight or 2 * a1 weight
...
No. 1-16 9/6/00
Positional Notation
Introduction to
Microprocessors
Number Systems and
Conversions
BASE 10
953.7810 = 9 x 102 + 5 x 101 + 3 x 100 + 7 x 10-1 + 8 x 10-2
BASE 2
1011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2
= 8
+
0
+
2
+
1
+
1/2
+ 1/4
= 11 3/4
= 11.75
No. 1-17 9/6/00
Conversion
Introduction to
Microprocessors
Number Systems and
Conversions
EXAMPLE (repeated division)
Convert 5310 to binary
2  53
2  26
divided by 2 leaves
26 2’s with 1 leftover which forms least significant bit
remainder = 1 = a0
2  13
remainder = 0 = a1
26
remainder = 1 = a2
23
remainder = 0 = a3
21
remainder = 1 = a4
0
remainder = 1 = a5 most significant digit
53 base 10 equals 110101
No. 1-18 9/6/00
32 + 16 + 4 + 1 = 53
Introduction to
Microprocessors
Number Systems and
Conversions
EXAMPLE
(fractional portion requires repeated multiplication)
Convert .62510 to binary
.625 X 2 = 1.250
.250 X 2 = 0.500
.500 x 2 = 1.000
a-1 = 1 remainder = .250 after 1.0 subtraction ms digit
a-2 = 0 remainder = .500
a-3 = 1 remainder = .000
Finished - No further multiplication possible!
.1012 = .5 + 0 + .125 =.62510
No. 1-19 9/6/00
Introduction to
Microprocessors
Number Systems and
Conversions
• EXAMPLE
Convert 0.710 to binary
.700 X 2 = 1.400
.400 X 2 = 0.800
.800 X 2 = 1.600
.600 X 2 = 1.200
.200 X 2 = 0.400
.400 X 2 = 0.800
a-1 = 1 remainder = .400
a-2 = 0 remainder = .800
a-3 = 1 remainder = .600
a-4 = 1 remainder = .200
a-5 = 0 remainder = .400
a-6 = 0 remainder = .800
Process starts to repeat
0.710 = 0.10110011001100.........(base 2)
No. 1-20 9/6/00
Code
Introduction to
Microprocessors
Number Systems and
Conversions
WRITING one’s and zero’s can be error prone when dealing with large
numbers. IBM came up with the following method of dealing with these
numbers. BASE 16 with digits 0 - 15 in base 10 are represented by the
016 = 00002 = 010
116 = 00012 = 110
216 = 00102 = 210
316 = 00112 = 310
416 = 01002 = 410
516 = 01012 = 510
616 = 01102 = 610
716 = 01112 = 710
816 = 10002 = 810
916 = 10012 = 910
A16 = 10102 = 1010
B16 = 10112 = 1110
C16 = 11002 = 1210
D16 = 11012 = 1310
E16 = 11102 = 1410
F16 = 11112 = 1510
No. 1-21 9/6/00
```