[PIC®/AVR®/dsPIC®产品] MCC的配置位设置方法

[复制链接]
1525|2
 楼主| zhuomuniao110 发表于 2024-5-25 21:50 | 显示全部楼层 |阅读模式
第一步第二步

第三步

第四步





本帖子中包含更多资源

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

×
 楼主| zhuomuniao110 发表于 2024-5-25 21:50 | 显示全部楼层
  1. /**
  2. * CONFIGURATION BITS Generated Driver Source File.
  3. *
  4. * [url=home.php?mod=space&uid=288409]@file[/url] config_bits.c
  5. *
  6. * @ingroup config_bitsdriver
  7. *
  8. * [url=home.php?mod=space&uid=247401]@brief[/url] This file contains the API Implementation for the Device Configuration Bits driver.
  9. *
  10. * [url=home.php?mod=space&uid=895143]@version[/url] Driver Version 2.0.2
  11. *
  12. * @version Package Version 2.1.6
  13. */
  14. /*
  15. ? [2024] Microchip Technology Inc. and its subsidiaries.

  16.     Subject to your compliance with these terms, you may use Microchip
  17.     software and any derivatives exclusively with Microchip products.
  18.     You are responsible for complying with 3rd party license terms  
  19.     applicable to your use of 3rd party software (including open source  
  20.     software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
  21.     NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
  22.     SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,  
  23.     MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
  24.     WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
  25.     INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
  26.     KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
  27.     MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
  28.     FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
  29.     TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
  30.     EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
  31.     THIS SOFTWARE.
  32. */

  33. // Configuration bits: selected in the GUI

  34. //CONFIG1
  35. #pragma config FEXTOSC = ECH     // External Oscillator Mode Selection->EC (external clock) above 8 MHz
  36. #pragma config RSTOSC = HFINTOSC_64MHZ     // Power-up Default Value for COSC->HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1

  37. //CONFIG2
  38. #pragma config FCMENP = ON     // Fail-Safe Clock Monitor Enable - Primary XTAL Enable->Fail-Safe Clock Monitor enabled; timer will flag FSCMP bit and OSFIF interrupt on EXTOSC failure.
  39. #pragma config CLKOUTEN = OFF     // Clock Out Enable->CLKOUT function is disabled
  40. #pragma config FCMEN = ON     // Fail-Safe Clock Monitor Enable->Fail-Safe Clock Monitor enabled
  41. #pragma config CSWEN = ON     // Clock Switch Enable->Writing to NOSC and NDIV is allowed
  42. #pragma config FCMENS = ON     // Fail-Safe Clock Monitor Enable - Secondary XTAL Enable->Fail-Safe Clock Monitor enabled; timer will flag FSCMP bit and OSFIF interrupt on SOSC failure.
  43. #pragma config PR1WAY = ON     // PRLOCKED One-Way Set Enable->PRLOCKED bit can be cleared and set only once

  44. //CONFIG3
  45. #pragma config MVECEN = OFF     // Multivector Enable->Interrupt contoller does not use vector table to prioritze interrupts
  46. #pragma config MCLRE = EXTMCLR     // Master Clear (MCLR) Enable->If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR
  47. #pragma config BOREN = SBORDIS     // Brown-out Reset Enable->Brown-out Reset enabled , SBOREN bit is ignored
  48. #pragma config PWRTS = PWRT_OFF     // Power-up Timer Selection->PWRT is disabled
  49. #pragma config IVT1WAY = ON     // IVTLOCK One-Way Set Enable->IVTLOCKED bit can be cleared and set only once
  50. #pragma config LPBOREN = OFF     // Low-Power BOR Enable->Low-Power BOR disabled

  51. //CONFIG4
  52. #pragma config XINST = OFF     // Extended Instruction Set Enable->Extended Instruction Set and Indexed Addressing Mode disabled
  53. #pragma config LVP = ON     // Low-Voltage Programming Enable->Low voltage programming enabled. MCLR/VPP pin function is MCLR. MCLRE configuration bit is ignored
  54. #pragma config ZCD = OFF     // ZCD Disable->ZCD module is disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON
  55. #pragma config STVREN = ON     // Stack Overflow/Underflow Reset Enable->Stack full/underflow will cause Reset
  56. #pragma config BORV = VBOR_1P9     // Brown-out Reset Voltage Selection->Brown-out Reset Voltage (VBOR) set to 1.9V
  57. #pragma config PPS1WAY = ON     // PPSLOCKED One-Way Set Enable->PPSLOCKED bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle

  58. //CONFIG5
  59. #pragma config WDTCPS = WDTCPS_31     // WDT Period Select->Divider ratio 1:65536; software control of WDTPS
  60. #pragma config WDTE = OFF     // WDT Operating Mode->WDT Disabled; SWDTEN is ignored

  61. //CONFIG6
  62. #pragma config WDTCWS = WDTCWS_7     // WDT Window Select->window always open (100%); software control; keyed access not required
  63. #pragma config WDTCCS = SC     // WDT Input Clock Selector->Software Control

  64. //CONFIG7
  65. #pragma config SAFEN = OFF     // Storage Area Flash (SAF) Enable->SAF disabled
  66. #pragma config BBEN = OFF     // Boot Block Enable->Boot block disabled
  67. #pragma config BBSIZE = BBSIZE_512     // Boot Block Size Selection->Boot Block size is 512 words

  68. //CONFIG8
  69. #pragma config WRTB = OFF     // Boot Block Write Protection->Boot Block not Write protected
  70. #pragma config WRTC = OFF     // Configuration Register Write Protection->Configuration registers not Write protected
  71. #pragma config WRTD = OFF     // Data EEPROM Write Protection->Data EEPROM not Write protected
  72. #pragma config WRTAPP = OFF     // Application Block Write Protection->Application Block not write protected
  73. #pragma config WRTSAF = OFF     // Storage Area Flash (SAF) Write Protection->SAF not Write Protected

  74. //CONFIG9
  75. #pragma config CP = OFF     // User Program Flash Memory and Data EEPROM Code Protection->PFM and Data EEPROM code protection disabled


  76. /**
  77. End of File
  78. */
看别人照片 发表于 2024-5-27 09:12 | 显示全部楼层
这个和STM32配置类似吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则

233

主题

3529

帖子

11

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