Chapter 1 Microcomputer System - Peripheral Design
Chapter 1 Microcomputer System - Peripheral Design
Chapter 1 Microcomputer System - Peripheral Design
MICROPROCESSOR AND
MICROCONTROLLER TECHNOLOGY
2
At the end of the class, you will be able:
3
EMBEDDED CONTROLLERS
• Embedded controllers are a
ubiquitous part of life today
• A key impact technology for
the 21st century
4
5
6
7
TYPES OF COMPUTERS
Mainframe
Minicomputer
Workstation
Microcomputer
Embedded
System
8
EVOLUTION OF COMPUTERS
9
EVOLUTIONS OF CPUs
10
MICROPROCESSOR VS
MICROCONTROLLER
VS
11
MICROPROCESSOR
12
13
What is an Embedded System
1. Special purpose computer –
usually with one specific task or application.
2. Usually embedded in a device which often has other
electronic and mechanical parts
3. Usually optimized for the specific task
4. Has the usual basic computer components –
CPU, memory, inputs & outputs
14
Constraints
An embedded system has software designed
to keep in view three constraints:
1. System memory
2. Processing power
3. Power consumption
15
SYSTEM ORGANIZATION
• Central Processing Unit (CPU)
• Memory
• Input/Output (I/O) circuitry CPU
• Buses
– Address bus
– Data bus
– Control bus
Address bus - carrying the address for the data inside the memory (24-bit)
Data bus - carrying the data in/out P (16-bit)
Control bus - carrying the signal which is used to control the devices and status of the devices.
(E.g.: read/write process)
16
CENTRAL PROCESSING UNIT (CPU)
• Directs the operation of the
other units by providing timing Control Unit
and control signals.
• Performs all the arithmetic and
logical operations.
• Holds values of internal Arithmetic Logic
operation, such as the address Unit
of the instruction being
executed and the data being
processed
• Accumulator, Program Counter
Register, Status Register Register
17
BUS SYSTEM
(address bus - unidirectional)
- A bus which carries an address from the uP to the memory. (
to confirm the location of an address).
- The total of address bit is can be used to determine the total
memory can be accessed in a memory system.
- The address is a one way direction which is from CPU to
other devices only
(Data bus – bidirectional)
- A bidirectional system bus due to the data can be transferred
either to or from CPU.
- Data can be either input or output based on the process out or
into the CPU which is read or write.
- The size of the data is based on the total data bit is being
19
CENTRAL PROCESSING UNIT (CPU)
Register : To
ALU : To
store
perform temporary
algorithm and data.
mathematical
operation.
Control Unit : To
control operation
by giving the
control signal and
the timing.
20
Embedded System
21
Examples
• Personal information products: Cell phone, pager, watch, pocket recor
der, calculator
• Laptop components: mouse, keyboard, modem,
fax card, sound card, battery charger
• Home appliances: door lock, alarm clock,
thermostat, air conditioner, tv remote, hair
dryer, VCR, small refrigerator, exercise
equipment, washer/dryer, microwave oven
• Toys; video games, cars, dolls, etc.
22
Embedded System
1. Microprocessors
CPU (Central Processing Unit) in a single chip; it
cannot work without support from others devices
such as memory, input & output device
2. Microcontrollers
compact microcomputer designed to govern the
operation of embedded systems. A typical
microcontroller includes a processor, memory, and
peripherals.
23
Microprocessor System Structure
24
Microcontroller System Structure
1. Essentially a
microprocessor chip
memories and I/O
devices
2. All in one solution-
reduction in chip
count
25
Microprocessor vs. Microcontroller
26
Microprocessor vs. Microcontroller
• MCU intended as a single chip solution, MPU requires external support
chips (memory, interface)
• MCU has on-chip non-volatile memory for program storage, MPU does
not.
• MCU has more interface functions on-chip (serial interfaces, Analog-to-
Digital conversion, timers, etc.) than MPU
• MCU does not have virtual memory support (I.e, could not run Linux),
while MPU does.
• • General purpose MPU s are typically higher performance (clock
speed, data width, instruction set, cache) than MCU s
27
Microcontroller
Advantages Disadvantages
1. It is cheaper to 1. Microcontrollers are
purchase a less flexible than
microcontroller than microprocessor as
all of the components individual
required for a components can not
microprocessors be replaced.
2. Reduced number of 2. Microprocessor can
components makes be easily upgraded
production easier and with higher
reliable specification devices.
28
Common Microcontroller
29
PIC Microcontrollers
Designed by Microchip Technology
Stands for Peripheral Interface Controller
Its first ancestor was designed in 1975 by General Instruments
30
PIC Microcontroller
PICs are popular with developers due to
1. Low cost
2. Wide availability
3. Large User base
4. Extensive collection of application notes
5. Availability of low cost or free development tools
6. Serial programming capabilities
31
32
PIC Microcontroller Architecture
All upgraded microcontrollers use one of two
basic design models called:
1. Harvard
2. Von-Neumann architecture.
33
PIC Microcontroller Architecture
• Harvard architecture the CPU can both read an instruction and perform a data memory access at
the same time, even without a cache.
• A Harvard architecture computer can thus be faster for a given circuit complexity because
instruction fetches and data access do not contend for a single memory pathway.
PIC Microcontroller Instruction Set
• All instructions understandable to the microcontroller are called
together the Instruction Set
• The main restriction here is a number of available instructions. The
manufacturers usually adopt either approach described below:
• RISC (REDUCED INSTRUCTION SET COMPUTER)
• CISC (COMPLEX INSTRUCTION SET COMPUTER)
36
CISC
1. Traditionally, CPUs are CISC
(Complex Instruction Set
Computing)
2. Used in : 80X86,8051,68HC11, etc.
3. Many instructions (usually > 100)
4. Several addressing modes
5. Usually takes more than 1 internal
clock cycle to execute
37
CISC (COMPLEX
INSTRUCTION SET
COMPUTING)
39
RISC
• PIC16F877 great advantages due to adoption of RISC:
• The CPU only recognizes 35 simple instructions (assembly language).
• The execution time is the same for almost all instructions and lasts for 4 clock
cycles.
• The oscillator frequency is stabilized by a quartz crystal.
• i.e. if the microcontroller’s operating speed is 20MHz, the execution time of each
instruction will be 200nS, i.e. the program will execute 5 million instructions per second!
40
RISC (REDUCED
INSTRUCTION SET
COMPUTING)
41
Characteristics of PIC Microcontroller
RISC
PIC
Harvard
42
Families of Microcontroller
43
PIC Families : Cores
44
Microchip Family
• Baseline core devices
1 • PIC10, PIC12 and PIC16
• 16 bit microcontroller
4 • PIC24 and dsPIC
45
Selecting Microcontrollers
• Choose the right one for your application
• Consider Cost,
• Performance,
• Package Software
• Integrated Peripherals, Support
• Development Environment
46
Inside PIC16/18 Microcontroller
47
CPU (Central Processing Unit)
CPU is manufactured with RISC technology as it is
an important factor when deciding which
microcontroller to use.
48
Memory / Storage
• The PIC16 has three types of memory ROM, RAM and EEPROM. All of
them will be separately discussed since each has specific functions,
features and organization
• Random Access Memory (RAM)
• Read Only Memory (ROM)
• Electrically Erasable PROM (EEPROM)
49
Memory / Storage
Random Access Memory (RAM)
The most complex part of microcontroller memory. It consists of two parts: general-purpose
registers and special-function registers (SFR).
Read Only Memory (ROM)
ROM memory is used to permanently save the program being executed. This is why it is often
called ‘program memory’.
Electrically Erasable PROM (EEPROM)
Similar to program memory, the contents of EEPROM is permanently saved, even when the
power goes off. However, unlike ROM, the contents of EEPROM can be changed during the
operation of the microcontroller.
50
Random Access Memory (RAM)
• General-purpose Registers
• General-purpose registers are used for storing temporary data and results
created during operation
• I.e. program of counting product
• Special Function Registers (SFRs)
• Special-function registers are also RAM memory locations, but unlike general-
purpose registers, their purpose is predetermined during manufacturing
process and cannot be changed.
• I.e. ADCON0 register controls the operation of A/D converter. Changing its bits
it is determined which port pin is to be configured as converter input, the
moment conversion is to start as well as the speed of conversion
51
Memory
52
Memory
1. Each memory address
corresponds to one
memory location.
2. The content of any
location becomes known
by its addressing.
3. Memory can either be
written to or read from.
4. There are several types of
memory within the
microcontroller.
53
Memory
54
MEMORY
Data lost upon power off – short term memory
Has two major types:
o Static RAM – fast, easy to interface but small sizes
RAM
o Dynamic RAM – Larger but requires refreshing operation, slow
ROM
55
Input / Output Ports
• In order to synchronize the operation of I/O ports with the internal 8-bit
organization of the microcontroller, they are, similar to registers
• many I/O pins are multifunctional.
• Every port has its ‘satellite’, i.e. the corresponding TRIS register: TRISA, TRISB,
TRISC etc. which determines the performance of port bits, but not their
contents
• I/O for PIC: Port A, Port B ….
56
Important Specification/Features
• Supply Voltage
• Clock
• Reset
• Timer
• Interrupt
• A/D Converter
57
Supply Voltage
• Standard logic voltage: +5v
• To generate the correct voltage
1. Fixed Voltage Regular
2. Variable Voltage Regulator
58
Clock
59
Reset
• Power-on Reset
• Keep the C in reset state until all the internal circuitry has been initialized
• External Reset
• To reset the microcontroller externally
60
Timers
• Counter driven from either internal/external clock
• PIC built-in Timer: TM0,TM1 … (8/16 bits)
• Applications:
• Counter
• Delay
• Interrupt
61
Interrupt
• Respond to external / internal (Timer) events
• During interrupt, C leaves its normal flow of program execution and
jump to Interrupt Service Routines (ISR)
62
Analog to Digital Converter
• Used to convert an analog signal to digital form
• ADC Characteristics
• Bits
• Channel
63
Development Process
64
Basic Circuitry
65
BASIC CIRCUIT
Reset
5V
Clock
Regulator
GND
66
Basic I/O Connection
67
Summary
• Microprocessors and embedded controller are a ubiquitous
part of life today
• These devices come in a wide variety of configurations and
designs
68
Appendix
69
THANK YOU
70