我用MPLAB X V5.20 XC8写程序
配置字如下:
#pragma config RETEN = OFF // VREG Sleep Enable bit (Ultra low-power regulator is Disabled (Controlled by REGSLP bit)),禁止超低功耗稳压器
#pragma config INTOSCSEL = HIGH // LF-INTOSC Low-power Enable bit (LF-INTOSC in High-power mode during Sleep),休眠期间 LF-INTOSC 处于高功耗模式
#pragma config SOSCSEL = DIG // SOSC Power Selection and mode Configuration bits (Digital (SCLKI) mode),SOSC 功耗选择和模式配置位,数字 ( SCLKI)模式;使能 RC0 和 RC1 的 I/O 端口功能
#pragma config XINST = OFF // Extended Instruction Set (Disabled),扩展指令集使能位,禁止指令集扩展和变址寻址模式 (传统模式)
// CONFIG1H
#pragma config FOSC = HS1 // Oscillator (HS oscillator (Medium power, 4 MHz - 16 MHz)),HS振荡器,中等功耗
#pragma config PLLCFG = ON // PLL x4 Enable bit (Enabled),打开PLL功能,系统时钟4倍频,变为32MHz
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor (Disabled),禁止故障保护时钟监视器
#pragma config IESO = OFF // Internal External Oscillator Switch Over Mode (Disabled),禁止双速启动
// CONFIG2L
#pragma config PWRTEN = OFF // Power Up Timer (Disabled),禁止上电延时定时器
#pragma config BOREN = SBORDIS // Brown Out Detect (Enabled in hardware, SBOREN disabled),只能由硬件使能欠压复位
#pragma config BORV = 3 // Brown-out Reset Voltage bits (1.8V),欠压复位电压选择为1.8v
#pragma config BORPWR = ZPBORMV // BORMV Power level (ZPBORMV instead of BORMV is selected),选择ZPBORMV而不是BORMV
// CONFIG2H
#pragma config WDTEN = OFF // Watchdog Timer (WDT disabled in hardware; SWDTEN bit disabled),关闭看门狗功能
//#pragma config WDTEN = SWDTDIS // Watchdog Timer (WDT enabled in hardware; SWDTEN bit disabled),由硬件使能WDT,禁止SWDTEN位
#pragma config WDTPS = 256 // Watchdog Postscaler (1:256),看门狗后分频1:256,溢出时间1.024s
// CONFIG3H
#pragma config CANMX = PORTB // ECAN Mux bit (ECAN TX and RX pins are located on RB2 and RB3, respectively),1 = CANTX 和 CANRX 引脚分别位于 RB2 和 RB3 上
#pragma config MSSPMSK = MSK7 // MSSP address masking (7 Bit address masking mode),1 = 使能 7 位地址掩码模式
#pragma config MCLRE = ON // Master Clear Enable (MCLR Enabled, RE3 Disabled),使能MCLR复位功能
// CONFIG4L
#pragma config STVREN = ON // Stack Overflow Reset (Enabled),堆栈满/下溢导致复位
#pragma config BBSIZ = BB2K // Boot Block Size (2K word Boot Block size),引导区大小选择2K
// CONFIG5L
#pragma config CP0 = OFF // Code Protect 00800-01FFF (Disabled),代码保护位
#pragma config CP1 = OFF // Code Protect 02000-03FFF (Disabled),代码保护位
#pragma config CP2 = OFF // Code Protect 04000-05FFF (Disabled),代码保护位
#pragma config CP3 = OFF // Code Protect 06000-07FFF (Disabled),代码保护位
// CONFIG5H
#pragma config CPB = OFF // Code Protect Boot (Disabled),引导区不受代码保护
#pragma config CPD = OFF // Data EE Read Protect (Disabled),数据EEPROM不受代码保护
// CONFIG6L
#pragma config WRT0 = OFF // Table Write Protect 00800-01FFF (Disabled),写保护位
#pragma config WRT1 = OFF // Table Write Protect 02000-03FFF (Disabled),写保护位
#pragma config WRT2 = OFF // Table Write Protect 04000-05FFF (Disabled),写保护位
#pragma config WRT3 = OFF // Table Write Protect 06000-07FFF (Disabled),写保护位
// CONFIG6H
#pragma config WRTC = OFF // Config. Write Protect (Disabled),配置寄存器不受写保护
#pragma config WRTB = OFF // Table Write Protect Boot (Disabled),引导区不受写保护
#pragma config WRTD = OFF // Data EE Write Protect (Disabled),数据EEPROM不受写保护
// CONFIG7L
#pragma config EBTR0 = OFF // Table Read Protect 00800-01FFF (Disabled),表读保护位
#pragma config EBTR1 = OFF // Table Read Protect 02000-03FFF (Disabled),表读保护位
#pragma config EBTR2 = OFF // Table Read Protect 04000-05FFF (Disabled),表读保护位
#pragma config EBTR3 = OFF // Table Read Protect 06000-07FFF (Disabled),表读保护位
// CONFIG7H
#pragma config EBTRB = OFF // Table Read Protect Boot (Disabled),引导区不受写保护
可是编译出错
请问高手,哪儿没配置对呢?谢谢!
|