Lecture 04 AV-314 PIC Memory Architecture
Lecture 04 AV-314 PIC Memory Architecture
Number of Slides: 16
1
Learning Objectives
2
PIC 16F877 Overview
3
PIC16Fx Memory Elements (Types)
PIC16Fx hosts three types of memories
1. ROM
– Also Known as Program memory
– Used to permanently save the program (code)
– 8K locations (8192 locations)
– 14 bits each
– Contents can be changed by providing a special
programming voltage (12 volts)
– Separate address bus (Harvard Architecture)
4
PIC16Fx Memory Elements (Types)
PIC16Fx hosts three types of memories
2. EEPROM
– Contents are retained even if power goes off
(similar to program memory)
– Contents can even be changed during operations
(Unlike program memory)
– Used to permanently save results during
operations
– 256 x 8 bits of EEPROM
5
PIC16Fx Memory Elements (Types)
PIC16Fx hosts three types of memories
3. RAM
– Data is lost if power is removed
– Contains
• General Purpose Registers (GPRs)
– 368 x 8 bits of memory
• Special Function Registers (SFRs)
6
PROGRAM MEMORY (ROM)
7
Program Memory
• 13 bit Program Counter
• Address space 213 = 8192
• Reset Vector at 0000H
• Interrupt Vector at 0004H
• Stack = Eight 13-bit registers
Source: Datasheet 8
Interrupt Handling Described
• Traffic Light Example
9
Memory Paging
• 2K (2048) size of segments
• 4 Pages
• Easy Management
• Call and Goto have 11bits
address
10
RAM (REGISTER FILES)
11
RAM Memory
12
RAM Register Types
• 8-Bit registers
• GPRs
– To store temporary data and results
– Can be utilized for general use
• SFRs
– Purpose is pre-determined and cannot be changed
– Bits are physically connected to specific peripherals
– Change in contents directly affect the relevant circuit
13
RAM Memory Organization
• Data memory is partitioned in 4 banks (blocks)
– Each contains 128 memory locations
• Bank selection through 2-bits of Status Register
16