- 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 - Constant ROM Arrays
Arrays declared in ROM are often useful. They are typically used for lookup tables or messages shown on a display. MPC distinguishes ROM arrays from normal data memory arrays by the const data type modifier.
The compiler implements ROM arrays with an ADDWF PC instruction followed by a series of RETLW instructions. To read an array element, the compiler places the index in the W register and generates a CALL to the start of the array. The compiler then adds the W register to the program counter and a RETLW returns the value in the W register. 17Cxx parts use TBLRD and TLRD instructions.
const char s[]="Byte Craft Limited!";
void main(){ char ch;
unsigned int i;
TRISB=0x00;
for (i=0; i<19;i++) PORTB=s[i];
} 
eTPU_C:
C6808: