/* _CONFIGx Bits taken from p24FJ256GA106.h */ /* Register CONFIG1 (0x2abfe) */ extern __attribute__((space(prog))) int _CONFIG1; #define _CONFIG1(x) __attribute__((section("__CONFIG1.sec"),space(prog))) int _CONFIG1 = (x); /* ** Only one invocation of CONFIG1 should appear in a project, ** at the top of a C source file (outside of any function). ** ** The following constants can be used to set CONFIG1. ** Multiple options may be combined, as shown: ** ** _CONFIG1( OPT1_ON & OPT2_OFF & OPT3_PLL ) ** ** Watchdog Timer Postscaler: ** WDTPS_PS1 1:1 ** WDTPS_PS2 1:2 ** WDTPS_PS4 1:4 ** WDTPS_PS8 1:8 ** WDTPS_PS16 1:16 ** WDTPS_PS32 1:32 ** WDTPS_PS64 1:64 ** WDTPS_PS128 1:128 ** WDTPS_PS256 1:256 ** WDTPS_PS512 1:512 ** WDTPS_PS1024 1:1,024 ** WDTPS_PS2048 1:2,048 ** WDTPS_PS4096 1:4,096 ** WDTPS_PS8192 1:8,192 ** WDTPS_PS16384 1:16,384 ** WDTPS_PS32768 1:32,768 ** ** WDT Prescaler: ** FWPSA_PR32 Prescaler ratio of 1:32 ** FWPSA_PR128 Prescaler ratio of 1:128 ** ** Watchdog Timer Window: ** WINDIS_ON Windowed Watchdog Timer enabled; FWDTEN must be 1 ** WINDIS_OFF Standard Watchdog Timer is enabled,(Windowed-mode is disabled) ** ** Watchdog Timer Enable: ** FWDTEN_OFF Watchdog Timer is disabled ** FWDTEN_ON Watchdog Timer is enabled ** ** Comm Channel Select: ** ICS_PGx3 Emulator functions are shared with PGEC3/PGED3 ** ICS_PGx2 Emulator functions are shared with PGEC2/PGED2 ** ICS_PGx1 Emulator functions are shared with PGEC1/PGED1 ** ** Set Clip On Emulation Mode: ** COE_ON Enabled ** COE_OFF Disabled ** ** Background Debug: ** BKBUG_ON Device resets into debug mode ** BKBUG_OFF Device resets into Operational mode ** ** General Code Segment Write Protect: ** GWRP_ON Writes to program memory are disabled ** GWRP_OFF Writes to program memory are allowed ** ** General Code Segment Code Protect: ** GCP_ON Code protection is enabled for the entire program memory space ** GCP_OFF Code protection is disabled ** ** JTAG Port Enable: ** JTAGEN_OFF JTAG port is disabled ** JTAGEN_ON JTAG port is enabled ** */ /* Register CONFIG2 (0x2abfc) */ extern __attribute__((space(prog))) int _CONFIG2; #define _CONFIG2(x) __attribute__((section("__CONFIG2.sec"),space(prog))) int _CONFIG2 = (x); /* ** Only one invocation of CONFIG2 should appear in a project, ** at the top of a C source file (outside of any function). ** ** The following constants can be used to set CONFIG2. ** Multiple options may be combined, as shown: ** ** _CONFIG2( OPT1_ON & OPT2_OFF & OPT3_PLL ) ** ** Primary Oscillator Select: ** POSCMOD_EC EC oscillator mode selected ** POSCMOD_XT XT oscillator mode selected ** POSCMOD_HS HS oscillator mode selected ** POSCMOD_NONE Primary oscillator disabled ** ** IOLOCK One-Way Set Enable bit: ** IOL1WAY_OFF Unlimited Writes To RP Registers ** IOL1WAY_ON Write RP Registers Once ** ** Primary Oscillator Output Function: ** OSCIOFNC_ON OSCO functions as port I/O (RC15) ** OSCIOFNC_OFF OSCO functions as CLKO (FOSC/2) ** ** Clock Switching and Monitor: ** FCKSM_CSECME Both Clock switching and Fail-safe Clock Monitor are enabled ** FCKSM_CSECMD Clock switching is enabled, Fail-safe Clock Monitor is disabled ** FCKSM_CSDCMD Both Clock Switching and Fail-safe Clock Monitor are disabled ** ** Oscillator Select: ** FNOSC_FRC Fast RC Oscillator (FRC) ** FNOSC_FRCPLL Fast RC oscillator with Postscaler and PLL module (FRCPLL) ** FNOSC_PRI Primary oscillator (XT, HS, EC) ** FNOSC_PRIPLL Primary oscillator (XT, HS, EC) with PLL module (XTPLL,HSPLL, ECPLL) ** FNOSC_SOSC Secondary oscillator (SOSC) ** FNOSC_LPRC Low-Power RC oscillator (LPRC) ** FNOSC_FRCDIV Fast RC oscillator with Postscaler (FRCDIV) ** ** Internal External Switch Over Mode: ** IESO_OFF IESO mode (Two-speed start-up)disabled ** IESO_ON IESO mode (Two-speed start-up) enabled ** */ /* -------------------------------------------------------- */ /* Macros for setting device configuration registers */ /* -------------------------------------------------------- */ /* Register CONFIG3 (0x2abfa) */ extern __attribute__((space(prog))) int _CONFIG3; #define _CONFIG3(x) __attribute__((section("__CONFIG3.sec"),space(prog))) int _CONFIG3 = (x); /* ** Only one invocation of CONFIG3 should appear in a project, ** at the top of a C source file (outside of any function). ** ** The following constants can be used to set CONFIG3. ** Multiple options may be combined, as shown: ** ** _CONFIG3( OPT1_ON & OPT2_OFF & OPT3_PLL ) ** ** WPFP_WPFP0 Page 0 (0x00) ** WPFP_WPFP1 Page 1 (0x400) ** ... ** WPFP_WPFP170 Page 170 (0x2A800) ** WPFP_WPFP511 Highest Page (same as page 170) ** ** Segment Write Protection Disable bit: ** WPDIS_WPEN Segmented code protection enabled ** WPDIS_WPDIS Segmented code protection disabled ** ** Configuration Word Code Page Protection Select bit: ** WPCFG_WPCFGEN Last page and Flash configuration words are code-protected ** WPCFG_WPCFGDIS Last page(at the top of program memory) and Flash configuration words are not protected ** ** Segment Write Protection End Page Select bit: ** WPEND_WPSTARTMEM Write Protect from page 0 to WPFP ** WPEND_WPENDMEM Write Protect from WPFP to the last page of memory ** */