Lecture 6 final
Lecture 6 final
Program Data
PIC-18 Memory
Memory CPU
Space Space
8-bit Data Bus
16-bit instruction
bus
FFF=212=16x256=4096=4K
PIC18F – MCU and Memory
16 bit
2 MB
221
8 bit
4 KB
212
PIC18F Memory
Program Memory: 32 K (215)
Address range: 000000 to 007FFFH
16-bit registers
Data EEPROM
Not part of the data memory space
Addressed through special function registers
Microprocessor Unit
Registers
Bank Select Register (BSR)
4-bit register used in direct
addressing the data memory
Data Memory is Divided into Banks and each Bank has 256 bytes.
Special function register are used to control the Operation of Peripheral functions.
Only on bank is active at any time.
Fig : Data Memory map for PIC-18 Device
PIC18F - Address Buses
Address bus
21-bit address bus for program
memory addressing capacity:
(221) = 2 MB of memory.
Organization
07Fh
080h
Bank 0 GPR
0FFh
100h
Bank 1
GPR
FFF=212=16x256=4096=4K 1FFh
200h
Bank 2
Data Memory up to 4k bytes GPR Access Bank
Data register map - with 12-bit 2FFh
00h
Access RAM (GPR)
address bus 000-FFF 7Fh
80h
Divided into 256-byte banks D00h
Access SFR
FFh
Bank 13
There are total of F banks GPR
256 Bytes
Rest Part of the program memory is located outside of the MCU chip.
Fig: Program Memory Organization for PIC-18 Device
PIC-18 PIPELINING
The PIC18 Divide most of the instruction execution into two
stages: instruction fetch and instruction execution.
Up to two instructions are overlapped in their execution. One instruction
is inexecution fetch stage while the second instruction is in execution stage.
Because of pipelining, each instruction appears to take one instruction
cycle to complete.
Fetch 1 Execute 1
Fetch 2 Execute 2
Fetch 3 Execute 3
Fetch 4 Flush
Addressable USART
Another serial data communication
A/D converter
Parallel Slave Port (PSP)
Capture, Compare and PWM (CCP Module)
PIC18F Special Features
Sleep mode
Power-down mode
Watchdog timer (WDT)
Able to reset the processor if the program is caught in
unknown state (e.g., infinite loop)
Code protection
EEPROM can be protected through SFR
In-circuit serial programming
In-circuit debugger