| 1 | /******************************************************************************/ |
| 2 | /* Main Files to Include */ |
| 3 | /******************************************************************************/ |
| 4 | |
| 5 | #if defined(__XC) |
| 6 | #include <xc.h> /* XC8 General Include File */ |
| 7 | #elif defined(HI_TECH_C) |
| 8 | #include <htc.h> /* HiTech General Include File */ |
| 9 | #endif |
| 10 | |
| 11 | /******************************************************************************/ |
| 12 | /* Configuration Bits */ |
| 13 | /* */ |
| 14 | /* Refer to your Hi-Tech User Manual in the PICC installation directory */ |
| 15 | /* /doc folder for more information on filling in configuration bits. */ |
| 16 | /* In addition, configuration bit mnemonics can be found in your */ |
| 17 | /* PICC\version\include\<processor name>.h file for your device. The XC8 */ |
| 18 | /* compiler contains documentation on the configuration bit macros within */ |
| 19 | /* the compiler installation /docs folder in a file called */ |
| 20 | /* pic18_chipinfo.html. */ |
| 21 | /* */ |
| 22 | /* For additional information about what the hardware configurations mean in */ |
| 23 | /* terms of device operation, refer to the device datasheet. */ |
| 24 | /* */ |
| 25 | /* A feature of MPLAB X is the 'Generate Source Code to Output' utility in */ |
| 26 | /* the Configuration Bits window. Under Window > PIC Memory Views > */ |
| 27 | /* Configuration Bits, a user controllable configuration bits window is */ |
| 28 | /* available to Generate Configuration Bits source code which the user can */ |
| 29 | /* paste into this project. */ |
| 30 | /* */ |
| 31 | /******************************************************************************/ |
| 32 | |
| 33 | |
| 34 | // PIC12F1840 Configuration Bit Settings |
| 35 | |
| 36 | // CONFIG1 |
| 37 | #pragma config FOSC = INTOSC // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin) |
| 38 | #pragma config WDTE = SWDTEN // Watchdog Timer Enable (WDT software enabled) |
| 39 | #pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled) |
| 40 | #pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input) |
| 41 | #pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) |
| 42 | #pragma config CPD = OFF // Data Memory Code Protection (Data memory code protection is disabled) |
| 43 | #pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled) |
| 44 | #pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin) |
| 45 | #pragma config IESO = OFF // Internal/External Switchover (Internal/External Switchover mode is disabled) |
| 46 | #pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled) |
| 47 | |
| 48 | // CONFIG2 |
| 49 | #pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off) |
| 50 | #pragma config PLLEN = ON // PLL Enable (4x PLL enabled) |
| 51 | #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset) |
| 52 | #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.) |
| 53 | #pragma config LVP = ON // Low-Voltage Programming Enable (Low-voltage programming enabled) |
| 54 | |
| 55 | |