PIC Microcontroller What is PC LATH?????
Memory Classification Program Memory (Flash) Data Memory General Purpose RAM Special Function Registers
Program Memory Organization 8k x 14 program memory space Divided into 4 pages of 2k words each 0H to 7FFH 800H to FFFH 1000H to 17FFH 1800H to 1FFFH Program PCLATH to switch between pages
Program Memory Organization PCLATH<4:3> = 00 PCLATH<4:3> = 10 Reset 0000h Page 2 1000h 0004h Interrupt Page 0 07FFh 17FFh PCLATH<4:3> = 01 PCLATH<4:3> = 11 Reset vector at 0, Interrupt vector at 4h In 2K Program memory, PCLATH has no impact In 4K Program memory, PCLATH bit 3 selects 2K page. Since PCLATH is not ininialized on reset (POR or otherwise), user must initialize PCLATH after reset. Page 1 0800h Page 3 1800h 0FFFh 1FFFh
Program Memory Map
Vectors Reset Vector Interrupt Vector Reset forces PC to 0x0000 H Clears the PCLATH So? Interrupt Vector Interrupt forces PC to 0x0004 H PCLATH is not modified
Program Counter PC is 13 bits wide Low byte – PCL is readable & writable High byte – PCH is not directly readable or writable All updates to PCH goes through PCLATH
Program Counter
Program Counter
Stack 8 level deep x 13 bit wide Not part of either program space or data space Stack pointer is not readable or writable
Stack PCLATH is not modified with a stack operation No status bits to indicate status overflow or underflow conditions No instructions called PUSH or POP