embeded assignment Microcontroller
embeded assignment Microcontroller
STREAM OF COMPUTER
EMBEDDED INDIVIDUAL ASSIGNMENT
NAME ID
DAWIT SIRAK EIT-M/UR158093/11
Microso
[Compa
[Date]
PIC16F877 Microcontroller — Full Memory
Organization
The memory system of the PIC16F877 is divided into three main types:
Each one has its own size, access method, and purpose.
Let's explain each one now:
It stores the compiled instructions of your program (like MOVLW, ADDWF, etc).
Microcontroller reads program memory to know what to execute.
➔ Size:
14 KB (8K x 14 bits).
o 8,192 words (each word = 14 bits).
➔ Structure:
➔ Memory Paging:
➔ Size:
2
368 bytes of RAM available.
➔ Bank Switching
Since all SFRs don't fit in one bank, you have to switch banks when needed.
Controlled by two bits in the STATUS register:
o RP1 and RP0.
3
RP1 RP0 Bank
1 0 Bank 2
1 1 Bank 3
Example:
If you want to access TRISB (data direction register for Port B), you must first switch to Bank
1.
assembly
BSF STATUS, RP0 ; Set RP0=1 (Bank 1)
BCF STATUS, RP1 ; Set RP1=0 (Bank 1)
➔ Stack Memory
3. 💾 EEPROM Memory
➔ Purpose:
➔ Size:
4
256 bytes EEPROM.
➔ Access:
(You must write two specific instructions sequence before EEPROM write is accepted.)
+------------------------------------+
| Data Memory |
| 368 bytes RAM (SRAM) |
| Banks (0,1 ,2, 3): GPRs + SFRs |
| Stack (8-level) |
+------------------------------------+
+------------------------------------+
| EEPROM Memory |
| 256 bytes Permanent Data Storage |
| Special read/write steps required |
+------------------------------------+
Concept Notes
Program Memory Holds the program, 14 bits wide instructions.
Data Memory Divided into banks, needs bank switching.
EEPROM Permanent storage, needs special handling.
Stack 8 levels deep, hardware managed.
Bank Switching Done with RP1 and RP0 bits in STATUS register.
🔥 Quick Example
5
Suppose you write a PIC program: