[PIC®/AVR®/dsPIC®产品] 配置字的问题

[复制链接]
1778|7
 楼主| 比神乐 发表于 2024-5-24 12:01 | 显示全部楼层 |阅读模式
我用MPLAB X V5.20 XC8写程序
配置字如下:
  1. #pragma config RETEN = OFF           // VREG Sleep Enable bit (Ultra low-power regulator is Disabled (Controlled by REGSLP bit)),禁止超低功耗稳压器
  2. #pragma config INTOSCSEL = HIGH      // LF-INTOSC Low-power Enable bit (LF-INTOSC in High-power mode during Sleep),休眠期间 LF-INTOSC 处于高功耗模式
  3. #pragma config SOSCSEL = DIG         // SOSC Power Selection and mode Configuration bits (Digital (SCLKI) mode),SOSC 功耗选择和模式配置位,数字 ( SCLKI)模式;使能 RC0 和 RC1 的 I/O 端口功能
  4. #pragma config XINST = OFF           // Extended Instruction Set (Disabled),扩展指令集使能位,禁止指令集扩展和变址寻址模式 (传统模式)

  5. // CONFIG1H
  6. #pragma config FOSC = HS1            // Oscillator (HS oscillator (Medium power, 4 MHz - 16 MHz)),HS振荡器,中等功耗
  7. #pragma config PLLCFG = ON           // PLL x4 Enable bit (Enabled),打开PLL功能,系统时钟4倍频,变为32MHz
  8. #pragma config FCMEN = OFF           // Fail-Safe Clock Monitor (Disabled),禁止故障保护时钟监视器
  9. #pragma config IESO = OFF            // Internal External Oscillator Switch Over Mode (Disabled),禁止双速启动

  10. // CONFIG2L
  11. #pragma config PWRTEN = OFF         // Power Up Timer (Disabled),禁止上电延时定时器
  12. #pragma config BOREN = SBORDIS      // Brown Out Detect (Enabled in hardware, SBOREN disabled),只能由硬件使能欠压复位
  13. #pragma config BORV = 3             // Brown-out Reset Voltage bits (1.8V),欠压复位电压选择为1.8v
  14. #pragma config BORPWR = ZPBORMV     // BORMV Power level (ZPBORMV instead of BORMV is selected),选择ZPBORMV而不是BORMV

  15. // CONFIG2H
  16. #pragma config WDTEN = OFF      // Watchdog Timer (WDT disabled in hardware; SWDTEN bit disabled),关闭看门狗功能
  17. //#pragma config WDTEN = SWDTDIS      // Watchdog Timer (WDT enabled in hardware; SWDTEN bit disabled),由硬件使能WDT,禁止SWDTEN位
  18. #pragma config WDTPS = 256          // Watchdog Postscaler (1:256),看门狗后分频1:256,溢出时间1.024s

  19. // CONFIG3H
  20. #pragma config CANMX = PORTB    // ECAN Mux bit (ECAN TX and RX pins are located on RB2 and RB3, respectively),1 = CANTX 和 CANRX 引脚分别位于 RB2 和 RB3 上
  21. #pragma config MSSPMSK = MSK7   // MSSP address masking (7 Bit address masking mode),1 = 使能 7 位地址掩码模式
  22. #pragma config MCLRE = ON      // Master Clear Enable (MCLR Enabled, RE3 Disabled),使能MCLR复位功能

  23. // CONFIG4L
  24. #pragma config STVREN = ON      // Stack Overflow Reset (Enabled),堆栈满/下溢导致复位
  25. #pragma config BBSIZ = BB2K     // Boot Block Size (2K word Boot Block size),引导区大小选择2K

  26. // CONFIG5L
  27. #pragma config CP0 = OFF        // Code Protect 00800-01FFF (Disabled),代码保护位
  28. #pragma config CP1 = OFF        // Code Protect 02000-03FFF (Disabled),代码保护位
  29. #pragma config CP2 = OFF        // Code Protect 04000-05FFF (Disabled),代码保护位
  30. #pragma config CP3 = OFF        // Code Protect 06000-07FFF (Disabled),代码保护位

  31. // CONFIG5H
  32. #pragma config CPB = OFF        // Code Protect Boot (Disabled),引导区不受代码保护
  33. #pragma config CPD = OFF        // Data EE Read Protect (Disabled),数据EEPROM不受代码保护

  34. // CONFIG6L
  35. #pragma config WRT0 = OFF       // Table Write Protect 00800-01FFF (Disabled),写保护位
  36. #pragma config WRT1 = OFF       // Table Write Protect 02000-03FFF (Disabled),写保护位
  37. #pragma config WRT2 = OFF       // Table Write Protect 04000-05FFF (Disabled),写保护位
  38. #pragma config WRT3 = OFF       // Table Write Protect 06000-07FFF (Disabled),写保护位

  39. // CONFIG6H
  40. #pragma config WRTC = OFF       // Config. Write Protect (Disabled),配置寄存器不受写保护
  41. #pragma config WRTB = OFF       // Table Write Protect Boot (Disabled),引导区不受写保护
  42. #pragma config WRTD = OFF       // Data EE Write Protect (Disabled),数据EEPROM不受写保护

  43. // CONFIG7L
  44. #pragma config EBTR0 = OFF      // Table Read Protect 00800-01FFF (Disabled),表读保护位
  45. #pragma config EBTR1 = OFF      // Table Read Protect 02000-03FFF (Disabled),表读保护位
  46. #pragma config EBTR2 = OFF      // Table Read Protect 04000-05FFF (Disabled),表读保护位
  47. #pragma config EBTR3 = OFF      // Table Read Protect 06000-07FFF (Disabled),表读保护位

  48. // CONFIG7H
  49. #pragma config EBTRB = OFF      // Table Read Protect Boot (Disabled),引导区不受写保护
可是编译出错

请问高手,哪儿没配置对呢?谢谢!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
huahuagg 发表于 2024-5-24 23:19 | 显示全部楼层
应该你这个配置字系统不认识。你应该在MCC里配置试试看。
 楼主| 比神乐 发表于 2024-5-25 05:10 | 显示全部楼层
谢谢,好了
看别人照片 发表于 2024-5-27 09:17 | 显示全部楼层
楼主是怎么解决的?
 楼主| 比神乐 发表于 2024-5-27 11:41 | 显示全部楼层
配置字是错的,要改成本芯片的配置字。
每个芯片配置字都不一样
原来是wjc 发表于 2024-9-28 23:18 | 显示全部楼层
充分体验3 nm工艺技术提供高性能和低功耗性能。
jiekou001 发表于 2024-9-29 14:31 | 显示全部楼层
不要这么做啊,在MCC里配置啊,不会出现在代码里吧。没看到。
jiekou001 发表于 2024-9-29 14:32 | 显示全部楼层
你可以先建一个空的工程,然后打开MCC,在里面有配置字设置。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

470

主题

3537

帖子

7

粉丝
快速回复 在线客服 返回列表 返回顶部