MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>MPLAB</strong> C <strong>Compiler</strong> <strong>for</strong> PIC18 <strong>MCUs</strong> vs. 16-Bit Devices<br />
D.7 STORAGE QUALIFIERS<br />
The PIC18 MCU <strong>Compiler</strong> uses the non-ANSI far, near, rom <strong>and</strong> ram type qualifiers.<br />
The 16-Bit Device <strong>Compiler</strong> uses the non-ANSI far, near <strong>and</strong> space attributes.<br />
EXAMPLE D-1: DEFINING A NEAR VARIABLE<br />
EXAMPLE D-2: DEFINING A FAR VARIABLE<br />
EXAMPLE D-3: CREATING A VARIABLE IN PROGRAM MEMORY<br />
D.8 PREDEFINED MACRO NAMES<br />
The PIC18 MCU <strong>Compiler</strong> defines __18CXX, __18F242, ... (all other processors with<br />
__ prefix) <strong>and</strong> __SMALL__ or __LARGE__, depending on the selected memory model.<br />
The 16-Bit Device <strong>Compiler</strong> defines __<strong>dsPIC</strong>30.<br />
D.9 INTEGER PROMOTIONS<br />
D.10 STRING CONSTANTS<br />
D.11 ACCESS MEMORY<br />
D.12 INLINE ASSEMBLY<br />
PIC18 near int gVariable;<br />
16-Bit __attribute__((near)) int gVariable;<br />
PIC18 far int gVariable;<br />
16-Bit __attribute__((far)) int gVariable;<br />
PIC18 rom int gArray[6] = {0,1,2,3,4,5};<br />
16-Bit __attribute__((space(psv)))<br />
const int gArray[6] = {0,1,2,3,4,5};<br />
The PIC18 MCU <strong>Compiler</strong> per<strong>for</strong>ms integer promotions at the size of the largest oper<strong>and</strong><br />
even if both oper<strong>and</strong>s are smaller than an int. This compiler provides the -Oi+<br />
option to con<strong>for</strong>m to the st<strong>and</strong>ard.<br />
The 16-Bit Device <strong>Compiler</strong> per<strong>for</strong>ms integer promotions at int precision or greater as<br />
m<strong>and</strong>ated by ISO.<br />
The PIC18 MCU <strong>Compiler</strong> keeps string constants in program memory in its .stringtable<br />
section. This compiler supports several variants of the string functions. For<br />
instance, the strcpy function has four variants allowing the copying of a string to <strong>and</strong><br />
from both data <strong>and</strong> program memory.<br />
The 16-Bit Device <strong>Compiler</strong> accesses string constants from data memory or from program<br />
memory through the PSV window, allowing constants to be accessed like any<br />
other data.<br />
16-bit devices do not have access memory.<br />
The PIC18 MCU <strong>Compiler</strong> uses non-ANSI _asm <strong>and</strong> _endasm to identify a block of<br />
inline assembly.<br />
The 16-Bit Device <strong>Compiler</strong> uses non-ANSI asm, which looks more like a function call.<br />
The compiler use of the asm statement is detailed in Section 9.4 “Using Inline<br />
Assembly Language”.<br />
© 2008 <strong>Microchip</strong> Technology Inc. DS51284H-page 205