SW500007 Microchip Technology, SW500007 Datasheet - Page 64

PICC-18 PRO

SW500007

Manufacturer Part Number
SW500007
Description
PICC-18 PRO
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC18r
Datasheets

Specifications of SW500007

Supported Families
PIC18
Core Architecture
PIC
Software Edition
Professional
Kit Contents
Software And Docs
Mcu Supported Families
PIC18
Tool Function
Compiler
Tool Type
Compiler
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
PIC18 Series
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
015P
778-1002
778-1002
Supported Data Types and Variables
because intvar is of class auto. To declare intvar as a persistent variable local to function
test(), write:
HI-TECH PICC-18 STD also supports the keywords bank1, bank2 and bank3. These keywords
have been included to allow code to be easily ported from PICC. These keywords are accepted by
HI-TECH PICC-18 STD, but have no effect in terms of the object’s storage or how they are accessed.
These keywords do, however, affect the storage of objects when compiling with the PICC compiler
- see your PICC manual for more details.
3.4.10.1 Persistent Type Qualifier
By default, any C variables that are not explicitly initialised are cleared to zero on startup. This is
consistent with the definition of the C language. However, there are occasions where it is desired for
some data to be preserved across resets.
In addition, any persistent variables will be stored in a different area of memory to other variables.
Persistent objects are placed within one of the non-volatile psects. If the persistent object is
also qualified near, it placed in the nvrram psect. Persistent bit objects are placed within the
nvbit psect. All other persistent objects are placed in the nvram psect.
A
3.4.10.2 Near Type Qualifier
The near type qualifier is used to place static variables in the access bank of the PIC18. Near
objects are represented by 8 bit addresses and the access bank is always accessable regardless of the
currently selected RAM bank so accessing near objects may be faster than accessing other objects,
and typically results in smaller code sizes.
50
for more information, and for an example of using persistent data.
The persistent type qualifier is used to qualify variables that should not be cleared on startup.
There are some library routines provided to check and initialise persistent data - see Appendix
Here is an example of an unsigned char object placed within the access bank:
void test(void) {
}
static persistent int intvar;
static near unsigned char fred;
persistent int intvar; /* WRONG! */
... other code ...
C Language Features

Related parts for SW500007