/* -------------------------------------------------------- */<br />/* Macros for setting device configuration registers */<br />/* -------------------------------------------------------- */<br /><br />/* Register CONFIG2 (0x157fc) */<br /><br />#define _CONFIG2(x) __attribute__((section("__CONFIG2.sec,code"))) int _CONFIG2 = (x);<br /><br />/*<br />** Only one invocation of CONFIG2 should appear in a project,<br />** at the top of a C source file (outside of any function).<br />**<br />** The following constants can be used to set CONFIG2.<br />** Multiple options may be combined, as shown:<br />**<br />** _CONFIG2( OPT1_ON & OPT2_OFF & OPT3_PLL )<br />**<br />** Two Speed Start-up:<br />** IESO_OFF Disabled<br />** IESO_ON Enabled<br />**<br />** Oscillator Selection:<br />** FNOSC_FRC Fast RC oscillator<br />** FNOSC_FRCPLL Fast RC oscillator w/ divide and PLL<br />** FNOSC_PRI Primary oscillator (XT, HS, EC)<br />** FNOSC_PRIPLL Primary oscillator (XT, HS, EC) w/ PLL<br />** FNOSC_SOSC Secondary oscillator<br />** FNOSC_LPRC Low power RC oscillator<br />** FNOSC_LPRCDIV Fast RC oscillator with divide<br />**<br />** Clock switching and clock monitor:<br />** FCKSM_CSECME Both enabled<br />** FCKSM_CSECMD Only clock switching enabled<br />** FCKSM_CSDCMD Both disabled<br />**<br />** OSCO/RC15 function:<br />** OSCIOFNC_ON RC15<br />** OSCIOFNC_OFF OSCO or Fosc/2<br />**<br />** Oscillator Selection:<br />** POSCMOD_EC External clock<br />** POSCMOD_XT XT oscillator<br />** POSCMOD_HS HS oscillator<br />** POSCMOD_NONE Primary disabled<br />**<br />*/<br /><br />#define IESO_OFF 0x7FFF<br />#define IESO_ON 0xFFFF<br /><br />#define FNOSC_FRC 0xF8FF<br />#define FNOSC_FRCPLL 0xF9FF<br />#define FNOSC_PRI 0xFAFF<br />#define FNOSC_PRIPLL 0xFBFF<br />#define FNOSC_SOSC 0xFCFF<br />#define FNOSC_LPRC 0xFDFF<br />#define FNOSC_LPRCDIV 0xFFFF<br /><br />#define FCKSM_CSECME 0xFF3F<br />#define FCKSM_CSECMD 0xFF7F<br />#define FCKSM_CSDCMD 0xFFBF<br /><br />#define OSCIOFNC_ON 0xFFDF<br />#define OSCIOFNC_OFF 0xFFFF<br /><br />#define POSCMOD_EC 0xFFFC<br />#define POSCMOD_XT 0xFFFD<br />#define POSCMOD_HS 0xFFFE<br />#define POSCMOD_NONE 0xFFFF<br /><br />/* Register CONFIG1 (0x157fe) */<br /><br />#define _CONFIG1(x) __attribute__((section("__CONFIG1.sec,code"))) int _CONFIG1 = (x);<br /><br />/*<br />** Only one invocation of CONFIG1 should appear in a project,<br />** at the top of a C source file (outside of any function).<br />**<br />** The following constants can be used to set CONFIG1.<br />** Multiple options may be combined, as shown:<br />**<br />** _CONFIG1( OPT1_ON & OPT2_OFF & OPT3_PLL )<br />**<br />** JTAG:<br />** JTAGEN_OFF Disabled<br />** JTAGEN_ON Enabled<br />**<br />** Code Protect:<br />** GCP_ON Enabled<br />** GCP_OFF Disabled<br />**<br />** Write Protect:<br />** GWRP_ON Enabled<br />** GWRP_OFF Disabled<br />**<br />** Background Debugger:<br />** BKBUG_ON Enabled<br />** BKBUG_OFF Disabled<br />**<br />** Clip-on Emulation mode:<br />** COE_ON Enabled<br />** COE_OFF Disabled<br />**<br />** ICD pins select:<br />** ICS_PGx1 EMUC/EMUD share PGC1/PGD1<br />** ICS_PGx2 EMUC/EMUD share PGC2/PGD2<br />**<br />** Watchdog Timer:<br />** FWDTEN_OFF Disabled<br />** FWDTEN_ON Enabled<br />**<br />** Windowed WDT:<br />** WINDIS_ON Enabled<br />** WINDIS_OFF Disabled<br />**<br />** Watchdog prescaler:<br />** FWPSA_PR32 1:32<br />** FWPSA_PR128 1:128<br />**<br />** Watchdog postscale:<br />** WDTPS_PS1 1:1<br />** WDTPS_PS2 1:2<br />** WDTPS_PS4 1:4<br />** WDTPS_PS8 1:8<br />** WDTPS_PS16 1:16<br />** WDTPS_PS32 1:32<br />** WDTPS_PS64 1:64<br />** WDTPS_PS128 1:128<br />** WDTPS_PS256 1:256<br />** WDTPS_PS512 1:512<br />** WDTPS_PS1024 1:1,024<br />** WDTPS_PS2048 1:2,048<br />** WDTPS_PS4096 1:4,096<br />** WDTPS_PS8192 1:8,192<br />** WDTPS_PS16384 1:16,384<br />** WDTPS_PS32768 1:32,768<br />**<br />*/<br /><br />#define JTAGEN_OFF 0xBFFF<br />#define JTAGEN_ON 0xFFFF<br /><br />#define GCP_ON 0xDFFF<br />#define GCP_OFF 0xFFFF<br /><br />#define GWRP_ON 0xEFFF<br />#define GWRP_OFF 0xFFFF<br /><br />#define BKBUG_ON 0xF7FF<br />#define BKBUG_OFF 0xFFFF<br /><br />#define COE_ON 0xFBFF<br />#define COE_OFF 0xFFFF<br /><br />#define ICS_PGx1 0xFEFF<br />#define ICS_PGx2 0xFFFF<br /><br />#define FWDTEN_OFF 0xFF7F<br />#define FWDTEN_ON 0xFFFF<br /><br />#define WINDIS_ON 0xFFBF<br />#define WINDIS_OFF 0xFFFF<br /><br />#define FWPSA_PR32 0xFFEF<br />#define FWPSA_PR128 0xFFFF<br /><br />#define WDTPS_PS1 0xFFF0<br />#define WDTPS_PS2 0xFFF1<br />#define WDTPS_PS4 0xFFF2<br />#define WDTPS_PS8 0xFFF3<br />#define WDTPS_PS16 0xFFF4<br />#define WDTPS_PS32 0xFFF5<br />#define WDTPS_PS64 0xFFF6<br />#define WDTPS_PS128 0xFFF7<br />#define WDTPS_PS256 0xFFF8<br />#define WDTPS_PS512 0xFFF9<br />#define WDTPS_PS1024 0xFFFA<br />#define WDTPS_PS2048 0xFFFB<br />#define WDTPS_PS4096 0xFFFC<br />#define WDTPS_PS8192 0xFFFD<br />#define WDTPS_PS16384 0xFFFE<br />#define WDTPS_PS32768 0xFFFF
|