PIC 16f877a Memory Organization
PIC 16f877a Memory Organization
PIC 16f877a Memory Organization
Embedded Systems
(MES)
Lecture #4
Memory Organization, Parallel Ports &
Clock Cycles
Instructor:
Dr. Tarek Barhoum
Agenda
Memory of the PIC 16f877
Parallel Input/Output
Parallel Interface
• INDF Register
• (INDirect through FSR, address = 00H, 80H)
INDF is not a physical register. Accessing INDF is actually
access the location pointed to by FSR in indirect addressing
mode.
PCL & PCLATH
• PCL Register
• (Program Counter Low Byte, address =02H, 82H)
PCL is actually the lower 8-bits of the 13-bit Program Counter. This is a both
readable and writable register.
• PCLATH Register
• (Program Counter LATcH, address = 0AH, 8AH)
PCLATH is a 8-bit register which can be used to decide the upper 5-bits of
the PC. PCLATH is not the upper 5bits of the PC. PCLATH can be read from or
written to without affecting the PC. The upper 3 bits of PCLATH remain zero
and they serve no purpose. When PCL is written to, the lower 5bits of
PCLATH are automatically loaded to the upper 5bits of the PC.
Memory Map Registers
• Is Flash Memory
• Used for storing
compiled code (user’s
program)
• Program Memory
capacity is 8K x 14 bit
Each location is 14 bits
long
Every instruction is
coded as a 14 bit word
• PC can address up to 8K
addresses
• Addresses H’000’
and
H’004’ are treated in a
special way
PIC16F877A Data Memory (RAM)
• Clock from the oscillator enters a microcontroller via OSC1 pin where
internal circuit of a microcontroller divides the clock into four even
clocks Q1, Q2, Q3 and Q4 which do not overlap.
• These four clocks make up one instruction cycle (also called
machine cycle) during which one instruction is executed.
Clock and Instruction Cycles..