Based on MPLAB X IDE Configuration Bits
The most important configuration options in the configuration word are:
Watchdog configuration such as: WDTE<1;0>; usually choose to turn off the watchdog
MCLRE reset pin configuration such as: MCLRE; generally choose the reset pin as I/O
Oscillator selection: For example: FOSC<2:0>; configure according to the actual situation, I usually choose to use the INTOSC internal oscillator.
Because if these three are not configured properly, the program will not run at all. For other configurations, please refer to the data manual.
MPLAB X IDE and MPLAB IDE 8 are different.
MPLAB IDE 8 allows you to select configuration bits in the interface. Configuration options do not need to be written in the code.
MPLAB X IDE must be configured in code if it is to be configured.
Example introduction:
1. Open MPLAB X IDE and click Window->PIC Memory Views->Configuration bits in the menu bar.
2 Change the option in each configuration in the Configuration Bits that appears. The red ones are the configuration options we have changed.
3 After configuration is completed, click Genarate Source Code to Output to generate the configuration source code.
Copy __CONFIG(FOSC_INTOSC & WDTE_OFF & PWRTE_ON & MCLRE_OFF & CP_ON & CPD_ON & BOREN_ON & CLKOUTEN_OFF & IESO_ON & FCMEN_ON); Here I point out an error in MPLAB X IDEv1.10. The compiler does not recognize the BORV_LO configuration in the configuration. This may be due to the lack of coordination between the programmer who wrote the software and the programmer who wrote the header file: The compiler only recognizes header files. In the header file pic16f1823.h, BORV_LO is not defined but it is defined as BORV_19. BORV_HI is defined as BORV_25. In short, just change BORV_LO to BORV_19. The following is an explanation of the configuration bits of 16F877A as requested by netizens: CP: Program Area Protection Setting this bit to 1 will turn it on. (This bit must be turned on to prevent the program from being read) DEBUG: Enable debugging. If not enabled, RB6 and RB7 pins will be used as normal I/O ports (depending on requirements). WRT1: WRT0: Write protection bit. Prevent the program area from being accidentally written. (Generally recommended to enable) CPD: EEPROM protection, (this bit must be turned on to prevent the data in the EEPROM from being read) LVP: Low voltage programming enable bit. If low voltage programming is not used, RB3 will be used as a normal I/O. MCLR must be used for programming. (As required) BOREN: Power-off detection. The function of power-off detection is to stop the microcontroller from working in time when it finds that the voltage is insufficient. This prevents some unexpected operations from happening, such as data loss in EEPROM or FLASH (this must generally be turned on to prevent code loss) PWRTEN: Power-on delay. After it is turned on, the MCU will delay 72MS to start working. Ensure that the MCU will start working after the circuit is stable after power-on. It is not required that the MCU work immediately after power-on. It is recommended to turn this bit on. (Recommended to turn it on) WDTEN: Watchdog. This bit depends on your needs. After it is turned on, the program must keep feeding the watchdog. If it is not fed well, the program will reset. (According to needs) FOSC1: FOSC0: Oscillator selection bits. If you want a high speed, choose HS. If you want a medium speed, choose XT. If you want a low speed and low power consumption, choose LP. If you want a cheap oscillator that does not require high precision, use RC. (Select according to your needs) 20MHz~4MHz (including 4MHz) quartz crystal configuration HS. 4MHz (including 4MHz) ~ 200KHz (including 200KHz) quartz crystal configuration XT. 200KHz (including 200KHz) ~ 32KHz quartz crystal configuration LP. RC is a resistor plus a capacitor. You can make a cheap but low-precision oscillator.
__CONFIG(WRT_OFF & PLLEN_OFF & STVREN_ON & BORV_LO & LVP_OFF); into the source code. The header file #include
Previous article:MPLAB X IDE v5.30 offline installation MCC method
Next article:HEX file format analysis - applicable to MPLAB
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Startup interface kernel code modification
- DC regulated power supply to charge the battery
- AWR1843BOOST mmw demo operation guide (Part 1)
- [NXP Rapid IoT Review] Offline Compilation and Testing Summary
- How to determine whether the power supply needs a PFC circuit?
- RFMD and Qorvo prototype boards vs. honeycomb heat sinks
- Is there any big guy who does MEMS process research and development? Please guide me
- Question about LED flashing (newbie question)
- Learn about vehicle-to-everything (V2X) technology in one article
- Evaluation of the domestic FPGA Gaoyun GW1N-4 series development board - Software Part 1