Bai2 Memory
Bai2 Memory
Lesson 2
MEMORY
ORGANIZATION
PIC16F887
PIC16F887
Harvard Architecture
Von Neumann
Architecture
Von Neumann Architecture:
Fetches instructions and data
from a single memory space
8-bit
Limits operating bandwidth
Program
Bus & Data
Memory
CPU
Harvard
Harvard Architecture:
Architecture
Uses two separate memory
spaces for program
8-bit
Bus
Data instructions and data
Memory
14-bit
CPU Improved operating bandwidth
Program
Bus
Allows for different bus widths
Memory
PIC16F887
PIC16F887 MEMORY
The PIC16F887 has three types of
memory:
ROM
RAM
EEPROM
PIC16F887
ROM MEMORY
ROM memory is used to permanently
save the program being executed.
This is why it is often called ‘program
memory’.
The PIC16F887 has 8Kb of ROM (in total
of 8192 locations).
Since the ROM memory is made with
FLASH technology, its contents can be
changed by providing a special
programming voltage (13V)
PIC16F887
ROM MEMORY
PIC16F887
EEPROM MEMORY
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.
This is why this memory (256 locations)
is perfect for permanently saving some
of the results created and used during
the operation.
PIC16F887
RAM MEMORY
RAM MEMORY
PIC16F887
GENERAL-PURPOSE REGISTERS
STACK
A part of RAM used as stack consists of eight
13-bit registers.
Before the microcontroller starts to execute a
subroutine (CALL instruction) or when an
interrupt occurs, the address of the first next
instruction to execute is pushed onto the
stack, i.e. one of its registers.
It helps microcontroller know from where to
continue regular program execution upon a
subroutine or an interrupt execution.
PIC16F887
STATUS REGISTER
STATUS REGISTER
STATUS REGISTER
TO - Time-out bit.
1 - After power-on, after executing the
CLRWDT instruction which resets the
watch-dog timer or the SLEEP
instruction which sets the microcontroller
into low-consumption mode.
0 - After watch-dog timer time-out has
occurred.
PIC16F887
STATUS REGISTER
PD - Power-down bit.
1 - After power-on or after executing the
CLRWDT instruction which resets the
watchdog timer.
0 - After executing the SLEEP
instruction which sets the
microcontroller into low-consumption
mode.
PIC16F887
STATUS REGISTER
Z - Zero bit
1 - The result of an arithmetic or
logic operation is zero.
0 - The result of an arithmetic or
logic operation is different from
zero.
PIC16F887
STATUS REGISTER
STATUS REGISTER
Lesson 2
MEMORY
ORGANIZATION