SW006012 Microchip Technology, SW006012 Datasheet - Page 94

C COMPILER FOR DSPIC30F FAMILY

SW006012

Manufacturer Part Number
SW006012
Description
C COMPILER FOR DSPIC30F FAMILY
Manufacturer
Microchip Technology
Type
MPLAB® C30 Compilerr
Series
PIC24 & DsPICr
Datasheets

Specifications of SW006012

Supported Families
PIC24, DsPIC30F And DsPIC33F
Core Architecture
PIC, DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24 MCUs And DsPIC DSCs
Tool Type
Compiler
Processor Series
PIC24, dsPIC
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
dsPIC30F
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
MPLAB
6.7
DS51284F-page 88
ACCESSING EEDATA FROM C CODE - dsPIC30F DSCS ONLY
®
C30 User’s Guide
For example, to declare two variables that retain their values across a device reset:
int _PERSISTENT var1,var2;
6.6.4
The following macros can be used to declare Interrupt Service Routines (ISRs):
#define _ISR
#define _ISRFAST
For example, to declare an ISR for the timer0 interrupt:
void _ISR _INT0Interrupt(void);
To declare an ISR for the SPI1 interrupt with fast context save:
void _ISRFAST _SPI1Interrupt(void);
MPLAB C30 provides some convenience macro definitions to allow placement of data
into the devices EE data area. This can be done quite simply:
int _EEDATA(2) user_data[] =
user_data will be placed in the EE data space reserving 10 words with the given initial
values.
The dsPIC DSC device provides two ways for programmers to access this area of
memory. The first is via the program space visibility window. The second is by using
special machine instructions (TBLRDx).
• Accessing EEDATA via the PSV
• Accessing EEDATA using TBLRDx instructions
• Additional Sources of Information
6.7.1
The compiler normally manages the PSV window to access constants stored in
program memory. If this is not the case, the PSV window can be used to access
EEDATA memory.
To use the PSV window:
• The PSVPAG register must be set to the appropriate address for the program
• The PSV window should also be enabled by setting the PSV bit in the CORCON
memory to be accessed. For EE data this will be 0xFF, but it is best to use the
__builtin_psvpage() function.
register. If this bit is not set, uses of the PSV window will always read 0x0000.
Note:
ISR Declaration Macros
Accessing EEDATA via the PSV
ISRs will be installed into the interrupt vector tables automatically if the
reserved names listed in Section 7.4 “Writing the Interrupt Vector” are
used.
__
attribute
__
attribute
__
((interrupt))
__
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
((interrupt, shadow))
© 2007 Microchip Technology Inc.

Related parts for SW006012