PCWHD IDE COMPILER Custom Computer Services Inc (CCS), PCWHD IDE COMPILER Datasheet - Page 63

PCWHD PIC10,16,18,24, DSPIC

PCWHD IDE COMPILER

Manufacturer Part Number
PCWHD IDE COMPILER
Description
PCWHD PIC10,16,18,24, DSPIC
Manufacturer
Custom Computer Services Inc (CCS)
Type
Compilerr
Datasheet

Specifications of PCWHD IDE COMPILER

For Use With/related Products
Microchip PIC10, PIC12, PIC16, PIC18, PIC24, dsPIC MCUs
Lead Free Status / RoHS Status
Not applicable / Not applicable
Other names
429-1009
Using Program Memory for Data
CCS C Compiler provides a few different ways to use program memory for data. The different ways
are discussed below:
Constant Data:
The CONST qualifier will place the variables into program memory. If the keyword CONST is used
before the identifier, the identifier is treated as a constant. Constants should be initialized and may
not be changed at run-time. This is an easy way to create lookup tables.
The ROM Qualifier puts data in program memory with 3 bytes per instruction space. The address
used for ROM data is not a physical address but rather a true byte address. The & operator can be
used on ROM variables however the address is logical not physical.
The #org preprocessor can be used to place the constant to specified address blocks.
The function label_address can be used to get the address of the constant. The constant variable
can be accessed in the code. This is a great way of storing constant data in large programs.
Variable length constant strings can be stored into program memory.
A special method allows the use of pointers to ROM. This method does not contain extra code at
the start of the structure as does constant.
The compiler allows a non-standard C feature to implement a constant array of variable length strings.
Where n is optional and id is the table identifier.
The syntax is:
For example:
Placing data into ROM
Placing a string into ROM
Creating pointers to constants
For example:
The constant ID will be at 1C00.
Note: Some extra code will precede the 123456789.
For example:
The syntax is:
For example:
const type id[cexpr] = {value}
const int table[16]={0,1,2...15}
const char cstring[6]={"hello"}
const char *cptr;
cptr = string;
#ORG 0x1C00, 0x1C0F
CONST CHAR ID[10]= {"123456789"};
char rom commands[] = {“put|get|status|shutdown”};
const char id[n] [*] = { "string", "string" ...};
const char colors[] [*] = {"Red", "Green", "Blue"};
49

Related parts for PCWHD IDE COMPILER