SW006012 Microchip Technology, SW006012 Datasheet - Page 95

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
© 2007 Microchip Technology Inc.
EXAMPLE 6-2:
#include <p30fxxxx.h>
int main(void) {
These steps need only be done once. Unless PSVPAG is changed, variables in EE
data space may be read by referring to them as normal C variables, as shown in the
example.
6.7.2
The TBLRDx instructions are not directly supported by the compiler, but they can be
used via inline assembly. Like PSV accesses, a 23-bit address is formed from an SFR
value and the address encoded as part of the instruction. To access the same memory
as given in the previous example, the following code may be used:
To use the TBLRDx instructions:
• The TBLPAG register must be set to the appropriate address for the program
• The TBLRDx instruction can only be accessed from an __asm__ statement; refer
EXAMPLE 6-3:
#include <p30fxxxx.h>
#define eedata_read(src, dest) {
int main(void) {
memory to be accessed. For EE data, this will be 0x7F, but it is best to use the
__builtin_tblpage() function.
to the “dsPIC30F/33F Programmer’s Reference Manual” (DS70157) for
information on this instruction.
PSVPAG =
CORCONbits.PSV = 1;
/* ... */
if (user_data[2]) ;/* do something */
}
register int eedata_addr;
register int eedata_val;
eedata_addr =
__
dest = eedata_val;
}
int value;
TBLPAG =
eedata_read(user_data[2], value);
if (value) ; /* do something */
}
Note:
asm
__
Accessing EEDATA using TBLRDx instructions
This access model is not compatible with the compiler-managed PSV
(-mconst-in-code) model. You should be careful to prevent conflict.
("tblrdl [%1], %0" : "=r"(eedata_val) : "r"(eedata_addr)); \
__
__
builtin_psvpage(&user_data);
builtin_tblpage(&user_data);
__
EEDATA ACCESS VIA PSV
EEDATA ACCESS VIA TABLE READ
builtin_tbloffset(&src); \
\
\
\
\
\
Device Support Files
DS51284F-page 89

Related parts for SW006012