- FAE/Client Login
- product registration
- > Download <
- Our products
- Support
- FAQs
- technical support
- Application Notes
- Device List
- Hints and Tips
- C38 - Special Page Access
- C6805 - Filling Unused ROM
- C6805 - Setting Multiple MORs
- C6805 - Working with MMEVS05/MMDS05
- C6808 and Emulators
- COP8C - Executing Initialization Code
- COP8C - S Register Support
- Debugging: Using Macros to Monitor Program Flow
- Declaring SPECIAL Memory
- LCD Interface
- LOCAL Memory
- Low Cost, Low Speed A/D conversion for Embedded Systems
- MPC - Branch Islands on the PIC16C5x
- MPC - Constant ROM Arrays
- MPC - Named Address Space
- MPC - Setting Configuration Fuses
- Non-linear Data Transformations
- Using the CodeWright(TM) Editor
- Product-specific Notes
- Resources
- Fuzzy Logic
- Publishing
- What's New
- About Us
- more information
MPC - Branch Islands on the PIC16C5x
The 8 bit address limitation of the 16C5x program counter imposes a restriction on the starting address of functions which presents added complexity. For example, on the 16C54 you cannot call a function that starts anywhere between 0x100-0x1FF as the 9th bit of the address in the CALL instruction is always 0.
MPC automatically inserts a branch island to overcome this restriction. The CALL to the function is replaced by a CALL to a corresponding branch island, which lies in the first part of the program memory. The branch island consists of any necessary clearing or setting of page bits to access the function, and a GOTO instruciton to the real function's starting address. The GOTO instruction does not have the 8 bit address limitation of CALL.
#pragma memory ROM [MAXROM - 0x00] @ 0x00;
// Inserted branch island #pragma memory RAM [MAXRAM - 0x09] @ 0x09;
#pragma memory RAM [MAXB0 - 0x10] @ 0x10;
#pragma memory RAM [MAXB1 - 0x30] @ 0x30;
#pragma memory RAM [MAXB2 - 0x50] @ 0x50;
#pragma memory RAM [MAXB3 - 0x70] @ 0x70;
void putchar(char ch);
void main(){ char c;
__TRIS(0x00,PORTB);
putchar(c);
}
#pragma memory ROM[MAXROM-0x700] @ 0x700;
void putchar(char ch){ PORTB=ch;
} 
July 2008: