SW006015 Microchip Technology, SW006015 Datasheet - Page 57

C COMPILER MPLAB C32

SW006015

Manufacturer Part Number
SW006015
Description
C COMPILER MPLAB C32
Manufacturer
Microchip Technology
Type
Compilerr
Series
PIC32r
Datasheets

Specifications of SW006015

Supported Families
PIC32MX5, MX6, And MX7
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC32 MCUs
Tool Function
Compiler
Supported Devices
PIC32 MCUs
Tool Type
Compiler
Processor Series
PIC32
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC32
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
4.6
4.7
© 2007 Microchip Technology Inc.
SPECIAL FUNCTION REGISTER ACCESS
CP0 REGISTER ACCESS
There are three steps to follow when using SFRs in an application.
1. Include either the generic processor header file (i.e., p32xxxx.h) or the
2. Access SFRs like any other C variables. The source code can write to and/or
3. Link with the default linker script or include the processor.o file for the
4.7.1
The CP0 register definitions header file (cp0defs.h) is a file that contains definitions
for the CP0 registers and their fields. In addition, it contains macros for accessing the
CP0 registers. The CP0 register definitions header file is located in
c:\Program Files\Microchip\MPLAB C32\pic32mx\include, where
c:\Program Files\Microchip\MPLAB C32 is the directory in which the MPLAB
C32 toolchain was installed. The CP0 register definitions header file was designed to
work with either Assembly or C files.
The CP0 register definitions header file is dependent on macros defined within the
processor generic header file (See Section 4.3 “Generic Processor Header File”).
To include the CP0 register definitions header file, use the following from within your
source code:
4.7.2
When the CP0 register definitions header file is included from an Assembly file, the
CP0 registers are defined as:
For example, the IntCtl register is defined as:
When the CP0 register definitions header file is included from a C file, the CP0 registers
and selects are defined as:
For example, the IntCtl register is defined as:
4.7.3
When the CP0 register definitions header file is included from either an Assembly or a
C file, three #defines exist for each of the CP0 register fields.
_CP0_
processor-specific header file for the appropriate device (e.g.,
proc/p32mx360f512l.h).
#include <p32xxxx.h>
read from the SFRs. For example, the following statement clears all the bits to
zero in the special function register for Timer 1:
TMR1 = 0;
The next statement enables the Watchdog Timer:
WDTCONbits.ON = 1;
appropriate processor in your project.
#include <p32xxxx.h>
#define _CP0_
#define _CP0_INTCTL $12, 1
#define _CP0_
#define _CP0_
#define _CP0_INTCTL 12
#define _CP0_INTCTL_SELECT 1
REGISTER
CP0 Register Definitions Header File
CP0 Register Definitions
CP0 Register Field Definitions
_
NAME
REGISTER
REGISTER
REGISTER
_
FIELD
_
_
_
_
NAME
NAME
NAME
NAME
_SELECT select_number
_POSITION – the starting bit location
$register_number, select_number
register_number
DS51686A-page 53

Related parts for SW006015