PIC16F88 03 Config Bits |
|
The configuration bits are used to turn subsystems on or off within the chip. Sometimes thay are called fuses. Modern chips allow these bits to be programmed many times. In olden times, the chip was programmed once by blowing actual fuses. If you did it wrong, you'd need a new chip.
The code snippet below can be copied and pasted. It gives a clock speed of 31.25 kHz and turns off most of the more advanced chip features. This is ideal for beginners.
To use other settings, there is a wizard in MPLAB X described in this video.
Or select Run ↠ Set Configuration Bits and follow the wizard.
;******************************************************************************* ; PIC16F88 Configuration Bit Settings ;******************************************************************************* #include "p16F88.inc" __CONFIG _CONFIG1, _FOSC_INTOSCIO & _WDTE_OFF & _PWRTE_OFF & _MCLRE_OFF & _BOREN_ON & _LVP_OFF & _CPD_OFF & _WRT_OFF & _CCPMX_RB0 & _CP_OFF __CONFIG _CONFIG2, _FCMEN_ON & _IESO_ON
;******************************************************************************* ; PIC16F88 Configuration Bit Settings ;******************************************************************************* #include "p16F88.inc" __CONFIG _CONFIG1, b'11111101010000' ; This method of setting the bits is not recommended __CONFIG _CONFIG2, b'11111111111111' ; To work out what's happening you'd need to read the manual!
__CONFIG _CONFIG1, b'11111101010000' ; DCBA9876543210 DCBA9876543210 ; |||||||||4||10 0--00 - FOSC --- LP Low Power - Low Frequency External Quartz Crystal Oscillator - 32.768 kHz ; |||||||||-||-- 0--01 - FOSC --- XT Medium Power - External Quartz Crystal Oscillator up to 8 MHz ; |||||||||-||-- 0--10 - FOSC --- HS High Speed - Quartz Crystal Oscillator over 8 MHz ; |||||||||-||-- 0--11 - FOSC --- ECIO - External Clock - I/O available on RA6 ; ---------1--00 |||||||||-||-- 1--00 - FOSC --- INTRC - Internal RC Oscillator - I/O available on RA6 and RA7 ; |||||||||-||-- 1--01 - FOSC --- INTRC - Internal RC Oscillator - CLKO - Clock Output on RA6 - I/O on RA7 ; |||||||||-||-- 1--10 - FOSC --- EXTRC - External RC Oscillator - I/O available on RA6 ; |||||||||-||-- 1--11 - FOSC --- EXTRC - External RC Oscillator - CLKO - Clock Output on RA6 ; -----------0-- |||||||||-|2-- ------- WDTEN -- 1 WDT Watchdog Timer is enabled - 0 disabled ; ----------0--- |||||||||-3--- ------- PWRTEN - 1 PWRT Power-up Timer is Enabled - 0 disabled ; --------0----- ||||||||5 ---- ------- MCLRE -- 1 Master Clear if RA5 goes low the chip is reset - 0 RA5 can be used for I/O ; -------1------ |||||||6 ----- ------- BOREN -- 1 Brown Out BOR is enabled and chip resets if power line fluctuates - 0 disabled ; ------0------- ||||||7 ------ ------- LVP ---- 1 RB3 is used for low voltage programming - 0 RB3 is used for I/O ; -----1-------- |||||8 ------- ------- CPD ---- 0 Protect EE Memory from accidental overwrite - 1 No Protection ; |||A9 -------- 00 --- WRT ---- 0x0000 to 0x0FFF flash program memory protection - Lots ; |||----------- 01 --- WRT ---- 0x0000 to 0x07FF flash program memory protection - Middling ; |||----------- 10 --- WRT ---- 0x0000 to 0x00FF flash program memory protection - Not much ; ---11--------- |||----------- 11 --- WRT ---- No flash program memory protection - None ; --1----------- ||B ---------- ------- DEBUG -- 1 RB6 and RB7 are I/O pins - 0 RB6 and RB7 are used for In Circuit Debugging ; -1------------ |C ----------- ------- CCPMX -- 1 CCP1 is on pin RB0 - 0 CCP1 is on pin RB3 - Use CCP to measure pulse length for example ; 1------------- D ------------ ------- CP ----- 1 No Code Protection - 0 Protect Chip Code (theft perhaps) __CONFIG _CONFIG2, b'11111111111111' ; DCBA9876543210 DCBA9876543210 ; -------------1 |0 ------- FCMEN -- 1 Fail Safe Clock Monitor Enabled - 0 disabled ; ------------1- 1- ------- EISO --- 1 Internal External Switchover Enabled - 0 disabled
Contact, Copyright, Cookies and Legalities: C Neil Bauers - reviseOmatic V4 - © 2016/17
Hosted at linode.com - London
Please report website problems to Neil