SW006012 Microchip Technology, SW006012 Datasheet - Page 93

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
6.6
© 2007 Microchip Technology Inc.
USING MACROS
Processor header files define, in addition to special function registers, useful macros
for the dsPIC30F family of Digital Signal Controllers (DSCs).
• Configuration Bits Setup Macros
• Inline Assembly Usage Macros
• Data Memory Allocation Macros
• ISR Declaration Macros
6.6.1
Macros are provided that can be used to set configuration bits. For example, to set the
FOSC bit using a macro, the following line of code can be inserted before the beginning
of your C source code:
This would enable the external clock with the PLL set to 16x and enable clock switching
and fail-safe clock monitoring.
Similarly, to set the FBORPOR bit:
This would enable Brown-out Reset at 2.7 Volts and initialize the Power-up timer to 64
milliseconds and configure the use of the MCLR pin for I/O.
For a complete list of settings valid for each configuration bit, refer to the processor
header file.
6.6.2
Some Macros used to define assembly code in C are listed below:
#define Nop()
#define ClrWdt() {
#define Sleep()
#define Idle()
6.6.3
Macros that may be used to allocate space in data memory are discussed below. There
are two types: those that require an argument and those that do not.
The following macros require an argument N that specifies alignment. N must be a
power of two, with a minimum value of 2.
#define _XBSS(N)
#define _XDATA(N)
#define _YBSS(N)
#define _YDATA(N)
#define _EEDATA(N)
For example, to declare an uninitialized array in X memory that is aligned to a 32-byte
address:
int _XBSS(32) xbuf[16];
To declare an initialized array in data EEPROM without special alignment:
int _EEDATA(2) table1[] = {0, 1, 1, 2, 3, 5, 8, 13, 21};
The following macros do not require an argument. They can be used to locate a
variable in persistent data memory or in near data memory.
#define _PERSISTENT
#define _NEAR
_FOSC(CSW_FSCM_ON & EC_PLL16);
_FBORPOR(PBOR_ON & BORV_27 & PWRT_ON_64 & MCLR_DIS);
Configuration Bits Setup Macros
Inline Assembly Usage Macros
Data Memory Allocation Macros
{
{
{
__
__
__
__
__
__
__
__
__
__
__
asm
asm
asm
asm
attribute
attribute
attribute
attribute
attribute
attribute
attribute
__
__
__
__
volatile ("nop");}
volatile ("clrwdt");}
volatile ("pwrsav #0");}
volatile ("pwrsav #1");}
__
__
__
__
__
__
__
((space(xmemory), aligned(N)))
((space(xmemory), aligned(N)))
((space(ymemory), aligned(N)))
((space(ymemory), aligned(N)))
((space(eedata),
((persistent))
((near))
Device Support Files
aligned(N)))
DS51284F-page 87

Related parts for SW006012