This document discusses the architecture of the PIC16F877A microcontroller. It begins with an introduction to PIC microcontrollers and describes the Harvard architecture used. It then covers the register file structure including general purpose registers, status register, and special function registers. Finally, it lists some applications of PIC microcontrollers such as street lights, temperature sensors, and industrial instrumentation.
3. INTRODUCTION:
â—¦ The term PIC or Peripheral Interface Controller, has been coined by Microchip
Technology Inc.
â—¦ Low-end range, mid-range and high end range of controllers.
â—¦ Its operational flexibility, availability and cheapness.
â—¦ PIC16F877A is a 40-pin PIC Microcontroller
4. Von-Neuman Architecture
MEMORY &
DATA
CPU
â—¦ Used in: 80X86 (PCs), 8051, 68HC11, etc.)
â—¦ Only one bus between CPU and memory
â—¦ RAM and program memory share the same bus and the same memory, and so
must have the same bit width
â—¦
5. Harvard Architecture
â—¦ PICs use the Harvard Architecture Used mostly in RISC
â—¦ Separate program bus and data bus: can be different widths!
For example, PICs use:
â—¦ Data memory (RAM): a small number of 8bit registers
â—¦ Program memory (ROM): 12bit, 14bit or 16bit wide (in EPROM, FLASH, or
ROM)
â—¦ 8 12 ,14 ,16
MEMORY
(DATA)
CPU
MEMORY
(PROGRAM)
6. CISC:
◦ Traditionally, CPUs are “CISC”
â—¦ Complex Instruction Set Computer (CISC)
â—¦ Used in: 80X86, 8051, 68HC11, etc.
â—¦ Many instructions (usually > 100)
â—¦ Many, many addressing modes
â—¦ Usually takes more than 1 internal clock cycle (T cycle) to execute
â—¦ Example: MC68HC05
7. RICS
◦ PICs and most Harvard chips are “RISC”
â—¦ Reduced Instruction Set Computer (RISC)
â—¦ Used in: SPARC, ALPHA, Atmel AVR, etc.
â—¦ Few instructions (usually < 50)
â—¦ Only a few addressing modes
â—¦ Executes 1 instruction in 1 internal clock cycle (Tcyc)
â—¦ Example: PIC16CXXX
8. WHAT IS NEW IN PIC?
â—¦ High performance RISC CPU with 30 no. of instruction set only
â—¦ Harvard Architecture Pipelined Instructions
â—¦ And a large number of Peripherals In-built
10. FEATURES
â—¦ 8kB of flash program memory
â—¦ 368bytes of Data memory
â—¦ 256-EEPROM data memory
â—¦ 15 Interrupts
â—¦ In-circuit programming 3 internal hardware timers
â—¦ Capture/Compare/PW M modules
â—¦ Up to 8 channels of 10- Bit A/D
â—¦ Built-in USART for serial communication 5 digital I/O ports (Up to 22 lines)
11. I/O Ports
â—¦ PIC 16F877A has FIVE I/O Ports
â—¦ A total of 33 pins are used for I/O operations.
PORT A
â—¦ Port A is 6 bit wide and bi-directional.
â—¦ Its corresponding data direction register is TRISA.
â—¦ If TRISA port pin is set to 1,corresponding port A pin will act as an input pin
and vice versa.
â—¦ Port A is used for analog inputs.
12. PORT B
â—¦ Port B is 8 bit wide and bi-directional.
â—¦ Its corresponding data direction register is TRISB. If TRISB port pin is set to
1,corresponding port B pin will act as an input pin and vice versa.
â—¦ Port B is used for Data Transmission.
13. PORT C
â—¦ Port C is 8 bit wide and bi-directional.
â—¦ Its corresponding data direction register is TRISC. If TRISC port pin is set to
1,corresponding port C pin will act as an input pin and vice versa.
â—¦ Port C is used for control registers(serial communication, I2C functions , serial
data transfer).
14. PORT D
â—¦ Port D is 8 bit wide and bi-directional.
â—¦Its corresponding data direction register is TRISD.
â—¦ If TRISD port pin is set to 1,corresponding port D pin will act as an input pin
and vice versa.
â—¦ Port D is used as Data port
15. PORT E
â—¦ Port E is 3 bit wide . They are for read, write and chip select operation.
â—¦ Each pin is individually configurable as inputs and outputs.
â—¦ Port E is generally used for controlling purposes.
16. TIMER
â—¦ Timer 0 - 8 bit
◦ can be used as a Timer/counter Timer 1 – 16 bit
◦ can be used as a Timer/counter Timer 2 – 8 bit Timer
â—¦ can be used as the PWM time-base for the PWM mode of the CCP module.
17. ARCHITECTURE
â—¦ IC Microcontroller architecture is based on Harvard architecture and supports
RISC architecture (Reduced Instruction Set Computer).
â—¦ PIC microcontroller architecture consists of memory organization (RAM,
ROM, STACK), CPU, timers, counter, ADC, DAC, serial communication,
CCP module and I/O ports.
â—¦ PIC microcontroller also supports the protocols like CAN, SPI, UART for
interfacing with other peripherals.
19. The Registers
â—¦ A register is a place inside the PIC that can be written to, read from or both.
â—¦ Think of a register as a piece of paper where you can look at and write
information on.
20. REGISTERFILESTRUCTURE
• Register file → locations that an instruction can access via an address.
• Register file consists of two component:-
1. General purpose register file (same as RAM)
2. Special purpose register file
21. RAM
(96 bytes)
Special
purpose
Register
(32 bytes)
Extra 64
bytes of
RAM in
PIC 16 C63
16 C65A
16 C73A
16 C74A
RAM
(32 bytes)
Special purpose
Register
(32
bytes)
Bank 0
128
bytes
Bank 1
128
bytes
7
F
2
0
1
F
0
0
F
F
C
0
B
F
A
0
9
F
8
0
22. Register File Structure in PIC 16F8xx
Registers in
PIC
16F8XX
W or
working
register (8
bit)
Status
Register
(8 bits)
SFR
(Special
Function
Registers)
GPR
(General
Purpose
Registers)
23. APPLICATION
â—¦ Street Light that Glows on Detecting Vehicle Movement
â—¦ Temperature sensing and controlling devices
â—¦ Fire detection & safety devices
â—¦ Industrial instrumentation devices
â—¦ Process control devices