Low Level Processor Control
4.6
4.7
SPECIAL FUNCTION 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
processor-specific header file for the appropriate device (e.g.,
proc/p32mx360f512l.h ).
#include <p32xxxx.h>
2. Access SFRs like any other C variables. The source code can write to and/or
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;
3. Link with the default linker script or include the processor.o file for the
appropriate processor in your project.
CP0 REGISTER ACCESS
4.7.1
CP0 Register Definitions Header File
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:
#include <p32xxxx.h>
4.7.2
CP0 Register Definitions
When the CP0 register definitions header file is included from an Assembly file, the
CP0 registers are defined as:
#define _CP0_ REGISTER _ NAME $register_number, select_number
For example, the IntCtl register is defined as:
#define _CP0_INTCTL $12, 1
When the CP0 register definitions header file is included from a C file, the CP0 registers
and selects are defined as:
#define _CP0_ REGISTER _ NAME register_number
#define _CP0_ REGISTER _ NAME _SELECT select_number
For example, the IntCtl register is defined as:
#define _CP0_INTCTL 12
#define _CP0_INTCTL_SELECT 1
4.7.3
CP0 Register Field Definitions
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_ REGISTER _ NAME _ FIELD _ NAME _POSITION – the starting bit location
? 2007 Microchip Technology Inc.
DS51686A-page 53
相关PDF资料
SW300003-EVAL LIBRARY SOFT MODEM-EVAL ONLY
SW300010-EVAL SPEECH RECOG LIBRARY-EVAL ONLY
SW300040-EVAL LIBRARY NOISE SUPPR-EVAL ONLY
SW300060-EVAL LIBRARY ACOUSTIC ECHO-EVAL ONLY
SW300070-EVAL SOFTWARE LIBR ENC/DEC EVAL ONLY
SW500012 HI-TECH C PRO FOR PIC32
SY87701LHI-EVAL BOARD EVAL SY87701 EXPERIMENT
SY87729LHI-EVAL BOARD EVAL N SY87729 EXPERIMENT
相关代理商/技术参数
SW006021-1 制造商:Microchip Technology 功能描述:MPLAB XC8 STANDARD COMPILER 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC8 STD 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC8 STANDARD 制造商:Microchip Technology Inc 功能描述:COMPILER, MPLAB XC8, STANDARD 制造商:Microchip Technology Inc 功能描述:MPLAB XC8 ANSI C Compiler for the PIC10 (12),(16),(18) (Workstation License) 制造商:Microchip Technology Inc 功能描述:MPLAB XC8 Standard Compiler 制造商:Microchip Technology Inc 功能描述:OPTOCOUPLERS; Core Architecture:PIC; Software Edition:Standard
SW006021-1N 制造商:Microchip Technology 功能描述:MPLAB XC8 STANDARD COMPILER (F 制造商:Microchip Technology Inc 功能描述:MPLAB XC8 STANDARD COMPILER (FLOATING LICENSE) - Boxed Product (Development Kits) 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC8 STD FLOAT LIC 制造商:Microchip Technology Inc 功能描述:MPLAB XC8 Standard Compiler (Fltng Lic)
SW006021-2 制造商:Microchip Technology 功能描述:MPLAB XC8 PRO COMPILER WORKSTATION LICENSE 制造商:Microchip Technology Inc 功能描述:MPLAB XC8 PRO COMPILER - Boxed Product (Development Kits) 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC8 PRO 制造商:Microchip Technology Inc 功能描述:COMPILER, MPLAB XC8, PRO 制造商:Microchip Technology Inc 功能描述:MPLAB XC8 ANSI PRO Compiler for the PIC10 (12),(16),(18) (Workstation License) 制造商:Microchip Technology Inc 功能描述:MPLAB XC8 PRO Compiler 制造商:Microchip Technology Inc 功能描述:SOFTWARE TOOL, MPLAB XC8 PRO COMPILER; Core Architecture:PIC; Supported Families:PIC10, PIC16, PIC18; Software Edition:Linux; License Type:Floating - node; No. of User Licenses:1; Supported Hosts:-
SW006021-2C 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC8 PRO CHI
SW006021-2N 功能描述:开发软件 MPLAB XC8 PRO Compiler (Fltng Lic) RoHS:否 制造商:Atollic Inc. 产品:Compilers/Debuggers 用于:ARM7, ARM9, Cortex-A, Cortex-M, Cortex-R Processors
SW006022-1 制造商:Microchip Technology 功能描述:MPLAB XC16 STANDARD COMPILER 制造商:Microchip Technology Inc 功能描述:MPLAB XC16 STANDARD COMPILER - Boxed Product (Development Kits) 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC16 STD 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC16 STANDARD 制造商:Microchip Technology Inc 功能描述:COMPILER, MPLAB XC16, STANDARD 制造商:Microchip Technology Inc 功能描述:MPLAB XC16 Standard Compiler (Workstation License) 制造商:Microchip Technology Inc 功能描述:OPTOCOUPLERS; Core Architecture:PIC, dsPIC; Software Edition:Standard
SW006022-1N 制造商:Microchip Technology 功能描述:MPLAB XC16 STANDARD COMPILER ( 制造商:Microchip Technology Inc 功能描述:MPLAB XC16 STANDARD COMPILER (FLOATING LICENSE) - Boxed Product (Development Kits) 制造商:Microchip Technology Inc 功能描述:COMPILER MPLAB XC16 FLOAT LIC 制造商:Microchip Technology Inc 功能描述:MPLAB XC16 Standard Compiler (Fltng Lic)
SW006022-2 功能描述:开发软件 MPLAB XC16 PRO Compiler RoHS:否 制造商:Microchip Technology 产品: 用于: