100% found this document useful (2 votes)
219 views

Pic18f Intro

The document discusses the PIC microcontroller. It describes PIC as a low-cost, popular 8-bit microcontroller made by Microchip with a Harvard architecture. It outlines the different families of PIC microcontrollers including baseline, mid-range, enhanced mid-range, and high-end. It then focuses on features of the PIC18F microcontroller including memory organization, registers, ports, timers, and special features like sleep mode and watchdog timer.

Uploaded by

Elena Gilbert
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
219 views

Pic18f Intro

The document discusses the PIC microcontroller. It describes PIC as a low-cost, popular 8-bit microcontroller made by Microchip with a Harvard architecture. It outlines the different families of PIC microcontrollers including baseline, mid-range, enhanced mid-range, and high-end. It then focuses on features of the PIC18F microcontroller including memory organization, registers, ports, timers, and special features like sleep mode and watchdog timer.

Uploaded by

Elena Gilbert
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 25

PIC Microcontroller

PIC – “Peripheral Interface Controller”


Made by Microchip Technology
Most popular by industry developers
Low cost
Availability
Extensive application notes
Serial programming
8-bit PIC families

The 8-bit family of RISC Havard-architecture microcontrollers are


based upon four different processor architectures with a common
core set of assembler instructions which are upwards compatible
across the sub-families.

The four sub-families are officially named:


Base-Line -
Mid-Range -
Enhanced Mid-Range -
High-End -
Base-Line - Devices based upon a processor core using a 12-bit
instruction set.
Microcontrollers with the prefix PIC10, PIC12 or PIC16 could be
base-line products.

Mid-Range - Devices based upon a processor core using a 14-bit


instruction set.
Microcontrollers with the prefix PIC12 or PIC16 could be mid-
range products.
The rfPIC12 devices (with integrated radio transmitter) also belong
to this family.
Enhanced Mid-Range - Devices based upon a processor core using a
14-bit instruction set with extended instruction set, larger memory
addressing and other improvements compared to mid-range
products.
Microcontrollers with the prefix PIC12F1 and PIC16F1 are
extended mid-range products.

High-End - Devices based upon a processing core using a 16-bit


instruction set, some of which may also have a high-level
programming language optimized extended instruction set and data-
memory addressing.
Microcontrollers with the prefix PIC18 will be a high-end product.
PIC 18F features
 8 bit, Low cost, low power consumption
 Speed: Harvard Architecture, RISC architecture, 1 instruction cycle = 4
clock cycles.
 Instruction set simplicity: The instruction set consists of just 37
instructions
 Power-on-reset
 Brown-out-reset : when the power supply goes below a specified
voltage (say 4V), it causes PIC to reset; hence malfunction is avoided.

PIC 18F features
 A watch dog timer (user programmable) resets the processor if the
software/program ever malfunctions and deviates from its normal
operation.
 Wide availability with high clock speed
 Low power crystal
 Mid range crystal
 High range crystal
 RC oscillator (low cost).
PIC 18F features
 Programmable timers.
 On-chip ADC.
 Up to 12 independent interrupt sources.
 Powerful output pin control (25 mA (max.) current sourcing
capability per pin.)
 EPROM/ROM/Flash memory option.
 PIC supports 12 independent interrupt sources.
 Capture/Compare/PWM (CCP)
 10bit PWM width within 8 bit PWM period
 I/O port
 Free assembler and simulator support from Microchip
PIC18F – MCU and Memory

16 bit

2 MB
221

8 bit

4 KB
212
PIC18F Memory
 Program Memory: 32 K (215)
 Address range: 000000 to 007FFFH
 16-bit registers

Data Memory: 4 K (212)


 Address range: 000 to FFFH
 8-bit registers

 Data EEPROM
 Not part of the data memory space
 Addressed through special function registers
Microprocessor Unit
 Registers
 Bank Select Register (BSR)
 4-bit register used in direct
addressing the data memory

 File Select Registers (FSRs)


 16-bit registers used as memory
pointers in indirect addressing data
memory

 Program Counter (PC)


 21-bit register that holds the
program memory address while
executing programs
Microprocessor Unit
 Control unit
 Provides timing and control signals to various
Read and Write operations
PIC18F - Address Buses
 Address bus
21-bit address bus for program
memory addressing capacity:
(221) = 2 MB of memory.

 12-bit address bus for data


memory
addressing capacity: (212) = 4 KB
of memory
Data Bus and Control Signals
 Data bus
 16-bit instruction/data
bus for program memory
 8-bit data bus for data
memory
 Control signals
 Read and Write
PIC18FMemory
 Program memory with  Data memory with
addresses (Flash) addresses
 Also called Data
Register or File
Register

FFF=212=16x256=4096=4K
PIC18F – Data Memory with Access Banks

 Three ways to access data registers:


 Direct using Bank Select Registers (BSR)
 Bank address (4-bit) + Instruction (8-bit)
 Indirect using File Select Registers (FSR)
 FSR contains the address of the data register
 Hence, MPU uses FSR
 Access Bank using General Purpose Registers
(GPR)
Data Memory 000h
Access RAM
07Fh
Organization 080h
0FFh
Bank 0 GPR

100h
Bank 1
GPR
FFF=212=16x256=4096=4K 1FFh
200h
Bank 2
 Data Memory up to 4k bytes GPR Access Bank
2FFh
 Data register map - with 12-bit Access RAM (GPR)
00h
7Fh
address bus 000-FFF
80h
Access SFR
 Divided into 256-byte banks D00h FFh
Bank 13
 There are total of F banks GPR
256 Bytes
DFFh
 Half of bank 0 and half of E00h GPR=General Purpose Reg.
bank 15 form a virtual bank Bank 14 SFR=Special Function Reg.
GPR
that is accessible no matter EFFh
which bank is selected F00h
Bank 15 GPR
F7Fh
F80h
FFFh Access SFR
PIC18F I/O Ports
 Five I/O ports
 PORT A through PORT E
 Most I/O pins are multiplexed
 Generally have eight I/O pins with
a few exceptions
 Addresses already assigned to
these ports in the design stage
 Each port is identified by its
assigned Special Function
Registers (SFR)
PORTA (address of F80)
PORTB (address of F81)
 these are part of data memory or
register file
TRISB must be set to specify signal direction of
PORT B.
Support Devices
Support Devices
 Timers
 A value is loaded in the register and continue changing at every clock
cycle – time can be calculated
 Can count on rising or falling edge
 There are several timers: 8-bit, 16-bit
 Controlled by SFR

 Master Synchronous Serial Port (MSSP)


 Serial interface supporting RS232

 Addressable USART
 Another serial data communication
 A/D converter
 Parallel Slave Port (PSP)
 Capture, Compare and PWM (CCP Module)
PIC18F Special Features
 Sleep mode
 Power-down mode
 Watchdog timer (WDT)
 Able to reset the processor if the program is caught in
unknown state (e.g., infinite loop)
 Code protection
 EEPROM can be protected through SFR
 In-circuit serial programming
 In-circuit debugger

You might also like