SW500009 Microchip Technology, SW500009 Datasheet - Page 63

HI-TECH FOR DSPIC/PIC24

SW500009

Manufacturer Part Number
SW500009
Description
HI-TECH FOR DSPIC/PIC24
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC24 & DsPICr
Datasheet

Specifications of SW500009

Supported Families
PIC24
Core Architecture
PIC, DsPIC
Software Edition
Standard
Kit Contents
Software And Docs
Tool Type
Compiler
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Lead Free Status / RoHS Status
Not applicable / RoHS Compliant
For Use With/related Products
DSPIC3X/PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
Other names
025
778-1003
778-1003
C Language Features
3.4.9.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 or even power cycles (on-off-on).
In addition, any persistent variables will be stored in a different area of memory to other variables.
persistent objects are placed within the psect nvram.
function they must be combined with the static keyword. For example, you may not write:
because intvar is of class auto. To declare intvar as a persistent variable local to function
test(), write:
If the PICC option, --STRICT is used, this type qualifier is changed to __persistent.
more information, and for an example of using persistent data.
3.4.9.2 Bank1, Bank2 and Bank3 Type Qualifiers
The bank1, bank2 and bank3 type qualifiers are used to place static variables in RAM bank 1,
RAM bank2 and RAM bank 3 respectively. Note that there is no bank0 qualifier. Objects default to
being in bank0 if no other bank qualifier is used. All auto objects are positioned into bank0, along
with function parameters. Examples of bank qualifier usage:
A pointer to an unsigned char in bank2:
A pointer to an unsigned char in bank3 with the pointer itself residing in bank2:
The persistent type qualifier is used to qualify variables that should not be cleared on startup.
This type qualifier may not be used on variables of class auto; if used on variables local to a
There are some library routines provided to check and initialise persistent data - see
An unsigned char in bank3:
void test(void)
{
}
static persistent int intvar;
static bank3 unsigned char fred;
bank2 unsigned char * ptr;
bank3 unsigned char * bank2 ptr2;
persistent int intvar; /* WRONG! */
.. other code ..
Supported Data Types and Variables
A
for
49

Related parts for SW500009