- FAE/Client Login
- product registration
- > Download <
- Our products
- Support
- FAQs
- technical support
- Installation
- 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
- eTPU - Function Set Support
- 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
- CODSupport
- Fixed Point
- Fuzzy Logic
- Publishing
- What's New
- About Us
- more information
MPC - Named Address Space
This tip takes advantage of a useful new feature: named address space. The #pragma memory RAM directive allows you to define the RAM limits of your system. The newest version of MPC allows you to name up to 15 of these defined RAM areas. Naming address space allows for the grouping of variables. For example, variables used in timing-critical sections of code can be grouped in an area which does not require a bank switching instruction for access.
#pragma option v;
#pragma has PIC12;
#pragma has PIC16C57;
#pragma vector __RESET @ 0x7FF;
#define MAXROM 0x800 // Total program memory
#define MAXRAM 0x10 // File register space
#define MAXB0 0x20 // File register space
#define MAXB1 0x40 // File register space
#define MAXB2 0x60 // File register space
#define MAXB3 0x80 // File register space
#pragma memory ROM [MAXROM - 0x00] @ 0x00;
#pragma memory RAM register[MAXRAM - 0x09] @ 0x09;
#pragma memory RAM [MAXB0 - 0x10] @ 0x10;
#pragma memory RAM [MAXB1 - 0x30] @ 0x30;
#pragma memory RAM bank2 [MAXB2 - 0x50] @ 0x50;
#pragma memory RAM [MAXB3 - 0x70] @ 0x70;
int array1[8];
int array2[16];
char k;
register char j;
char bank2 l;
void main()
{
int register i;
i = 0xFF;
do {
NOP();
} while(i--);
l=k;
}

eTPU_C:
C6808: