Sei sulla pagina 1di 23

Company

LOGO
Introduction to the
PIC Microcontroller
EC501: EMBEDDED SYSTEM APPLICATION
2
Outline
What is Microcontroller?
C vs General-Purpose P
A Brief History of PIC C
PIC18F4550 Features
PIC Clock Generator
Reset
3
What is Microcontroller?
Integrated chip that contains CPU, RAM, some
form of ROM, I/O ports, and timers
Designed for a
very specific task
to control a
particular system
reduce production
cost
4
C vs General-Purpose P
Microcontroller Microprocessor
Devices Microchips PICs
series, Atmels AVR
series
Intels x86 family (8086,
80286, 80386, 80486 &
the Pentium) or
(Motorolas PowerPC
family)
Components Internal CPU, RAM,
ROM, I/O ports and
timers
External RAM, ROM, and
I/O ports
Application Perform specific
function: A small set
of signal processing
functions for digital
signal processor
Perform more tasks that
related to general
requirements:
calculations of software,
personal computer
5
C vs General-Purpose P
Cont
CPU / P


Register

Control Unit

ALU

DATA BUS
CPU / P

Register

Control Unit

ALU

ADDRESS BUS
CONTROL BUS
C

RAM

ROM

I/O

Timer

Serial
COM
6
C vs General-Purpose P
Cont
M
i
c
r
o
p
r
o
c
e
s
s
o
r
EEPROM
RAM
Input
and
output
ports
Serial I/O
Parallel I/O
Timer
PWM
Input
and
output
ports
A/D
D/A
Analog
I/O
ROM
M
i
c
r
o
p
r
o
c
e
s
s
o
r
EEPROM
RAM
Input
and
output
ports
Serial I/O
Parallel I/O
Timer
PWM
Input
and
output
ports
A/D A/D
D/A D/A
Analog
I/O
ROM
Microprocessor-based System Microcontroller-based System
7
A Brief History of PIC C
In 1989, Microchip Technology Corporation
introduced an 8-bit C called PIC (Peripheral
Interface Controller).
This 8 pins chip contains a small amounts of
data RAM, a few hundred bytes of on-chip ROM
for program, one timer, and a few pins for I/O
ports.
The family of 8-bit C: 10xxx, 12xxx, 14xxx,
16xxx, 17xxx, and 18xxx
8
A Brief History of PIC C
Cont
http://www.microchip.com
9
A Brief History of PIC C
They are all 8-bit processors that the CPU can
work on only 8 bits of data a time.
Problem: not all 100% upwardly compatible in
terms of software when going from one family to
another family.
Ex.: 12xxx - 12-bit wide instructions
16xxx- 14-bit wide instructions
PIC18xxx - 16-bit wide with many
new instructions
Cont
10
A Brief History of PIC C
Advantages of PIC:
30 to 100 times faster than other Cs (program
memory is integrated to the chip)
Smaller size (on-board memory)
Easy to program, reusable and inexpensive
Cont
11
A Brief History of PIC C
Architecture:
Cont
CPU
Program &
Data Memory
Von Neumann architecture
CPU
Program
Memory
Data
Memory
Harvard architecture
12
Review
1. A C normally has which of the following
devices on-chip?
(a) RAM (b) ROM (c) I/O (d) all of the above

2. A general-purpose microprocessor normally
needs which of the following devices to be
attached to it?
(a) RAM (b) ROM (c) I/O (d) all of the above

3. The PIC16 has a(n) ___-bit P.
13
PIC18F4550 Features
40 pins, DIP40 type (Dual in Package) or SMD
type
14
PIC18F4550 Features
Cont
Block
diagram of
PIC18f4550
15
PIC18F4550 Features
16
PIC Clock Generator
4To provide a clock for executing a program or
program instructions of C.
4Types of PIC clock generator:
A crystal & two capacitors
Resonators or external resistor-capacitor pair
Built-in resistor-capacitor
17
PIC Clock Generator
Cont
PIC18F4550 can operate in four different
oscillation modes:
- LP low power crystal
- XT crystal/resonator
- HS high speed crystal/resonator
- RC resistor/capacitor
Two configuration bits, FOSC1 & FOSC0 are
used to select one of these four modes
18
PIC Clock Generator
Cont
Crystal Oscillator/Ceramic Resonators
For XT, LP or HS OSC configurations
Crystal or ceramic resonator is connected to the
OSC1/CLKIN & OSC2/CLKOUT pins
19
PIC Clock Generator
Cont
A parallel cut crystal is used to design
PIC18F4550
The use of a series cut crystal may give a freq.
out of the crystal manufacturers specifications
20
PIC Clock Generator
Cont
Capacitor selection for ceramic resonators
Capacitor selection for crystal resonators
21
PIC Clock Generator
Cont
RC Oscillator










Reduce cost for timing insensitive applications
Variation of the oscillator frequency:
- operating temperature
- process parameter variation
- difference in lead frame capacitance between package types (low
CEXT values)
- tolerance of the external R & C components
22
Reset
Power-on Reset (POR)
MCLR during normal operation
MCLR during SLEEP
WDT Reset (during normal
operation)
WDT Wake-up (during SLEEP)
Register Reset value (hex)
PC 000000
WREG 00
SP 00
TRISA-
TRISB
FF
Value registers upon reset
23
Review
1. Which pin is used to reset the PIC18F4550
chip?
2. Upon power-up, the program counter (PC) has a
value of ____.
3. MCLR is an active-_____ (LOW, HIGH) pin.
4. How many Vdd and Gnd pins are in the
PIC18F4550 chip?
5. In the PIC18, the program counter is ____ bits
wide.

Potrebbero piacerti anche