|
#pragma config <setting>=<named value>
|
|---|
For example:// External Oscillator Selection : EC (external clock) above 8 MHz; PFM set to high power |
|
#pragma config <setting>=<literal constant>
|
|---|
For example:// External Oscillator Selection : EC (external clock) above 8 MHz; PFM set to high power |
|
#pragma config <register>=<literal constant>
|
|---|
For example:// External Oscillator Selection : EC (external clock) above 8 MHz; PFM set to high power |
For example:// IDLOC @ 0x200000 |
|
config "<setting>"="<named value>"
|
|---|
For example:; External Oscillator Selection : EC (external clock) above 8 MHz; PFM set to high power |
|
config "<setting>"=<literal constant>
|
|---|
For example:; External Oscillator Selection : EC (external clock) above 8 MHz; PFM set to high power |
|
config "<register>"=<literal constant>
|
|---|
For example:; External Oscillator Selection : EC (external clock) above 8 MHz; PFM set to high power |
For example:; IDLOC @ 0x200000 |
|
Register: CONFIG1L @ 0x300000
|
|
|---|---|
| FEXTOSC | External Oscillator Selection |
| LP | LP (crystal oscillator) optimized for 32.768 kHz; PFM set to low power |
| XT | XT (crystal oscillator) above 100 kHz, below 8 MHz; PFM set to medium power |
| HS | HS (crystal oscillator) above 8 MHz; PFM set to high power |
| OFF | Oscillator not enabled |
| ECL | EC (external clock) below 100 kHz; PFM set to low power |
| ECM | EC (external clock) for 500 kHz to 8 MHz; PFM set to medium power |
| ECH | EC (external clock) above 8 MHz; PFM set to high power |
| RSTOSC | Reset Oscillator Selection |
| HFINTOSC_64MHZ | HFINTOSC with HFFRQ = 64 MHz and CDIV = 1:1 |
| EXTOSC_4PLL | EXTOSC with 4x PLL, with EXTOSC operating per FEXTOSC bits |
| SOSC | Secondary Oscillator |
| LFINTOSC | Low-Frequency Oscillator |
| HFINTOSC_1MHZ | HFINTOSC with HFFRQ = 4 MHz and CDIV = 4:1 |
| EXTOSC | EXTOSC operating per FEXTOSC bits (device manufacturing default) |
|
Register: CONFIG1H @ 0x300001
|
|
|---|---|
| CLKOUTEN | Clock out Enable bit |
| OFF | CLKOUT function is disabled |
| ON | CLKOUT function is enabled |
| PR1WAY | PRLOCKED One-Way Set Enable bit |
| ON | PRLOCK bit can be cleared and set only once |
| OFF | PRLOCK bit can be set and cleared repeatedly |
| CSWEN | Clock Switch Enable bit |
| OFF | The NOSC and NDIV bits cannot be changed by user software |
| ON | Writing to NOSC and NDIV is allowed |
| FCMEN | Fail-Safe Clock Monitor Enable bit |
| OFF | Fail-Safe Clock Monitor disabled |
| ON | Fail-Safe Clock Monitor enabled |
|
Register: CONFIG2L @ 0x300002
|
|
|---|---|
| MCLRE | MCLR Enable bit |
| EXTMCLR | If LVP = 0, MCLR pin is MCLR; If LVP = 1, RE3 pin function is MCLR |
| INTMCLR | If LVP = 0, MCLR pin function is port defined function; If LVP =1, RE3 pin fuction is MCLR |
| PWRTS | Power-up timer selection bits |
| PWRT_OFF | PWRT is disabled |
| PWRT_64 | PWRT set at 64ms |
| PWRT_16 | PWRT set at 16ms |
| PWRT_1 | PWRT set at 1ms |
| MVECEN | Multi-vector enable bit |
| ON | Multi-vector enabled, Vector table used for interrupts |
| OFF | Interrupt contoller does not use vector table to prioritze interrupts |
| IVT1WAY | IVTLOCK bit One-way set enable bit |
| ON | IVTLOCK bit can be cleared and set only once |
| OFF | IVTLOCK bit can be cleared and set repeatedly |
| LPBOREN | Low Power BOR Enable bit |
| OFF | ULPBOR disabled |
| ON | ULPBOR enabled |
| BOREN | Brown-out Reset Enable bits |
| SBORDIS | Brown-out Reset enabled , SBOREN bit is ignored |
| NOSLP | Brown-out Reset enabled while running, disabled in Sleep; SBOREN is ignored |
| ON | Brown-out Reset enabled according to SBOREN |
| OFF | Brown-out Reset disabled |
|
Register: CONFIG2H @ 0x300003
|
|
|---|---|
| BORV | Brown-out Reset Voltage Selection bits |
| VBOR_2P45 | Brown-out Reset Voltage (VBOR) set to 1.9V |
| VBOR_245 | Brown-out Reset Voltage (VBOR) set to 2.45V |
| VBOR_2P7 | Brown-out Reset Voltage (VBOR) set to 2.7V |
| VBOR_2P85 | Brown-out Reset Voltage (VBOR) set to 2.8V |
| ZCD | ZCD Disable bit |
| OFF | ZCD disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON |
| ON | ZCD always enabled |
| PPS1WAY | PPSLOCK bit One-Way Set Enable bit |
| ON | PPSLOCK bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle |
| OFF | PPSLOCK bit can be set and cleared repeatedly (subject to the unlock sequence) |
| STVREN | Stack Full/Underflow Reset Enable bit |
| ON | Stack full/underflow will cause Reset |
| OFF | Stack full/underflow will not cause Reset |
| DEBUG | Debugger Enable bit |
| OFF | Background debugger disabled |
| ON | Background debugger enabled |
| XINST | Extended Instruction Set Enable bit |
| OFF | Extended Instruction Set and Indexed Addressing Mode disabled |
| ON | Extended Instruction Set and Indexed Addressing Mode enabled |
|
Register: CONFIG3L @ 0x300004
|
|
|---|---|
| WDTCPS | WDT Period selection bits |
| WDTCPS_0 | Divider ratio 1:32 |
| WDTCPS_1 | Divider ratio 1:64 |
| WDTCPS_2 | Divider ratio 1:128 |
| WDTCPS_3 | Divider ratio 1:256 |
| WDTCPS_4 | Divider ratio 1:512 |
| WDTCPS_5 | Divider ratio 1:1024 |
| WDTCPS_6 | Divider ratio 1:2048 |
| WDTCPS_7 | Divider ratio 1:4096 |
| WDTCPS_8 | Divider ratio 1:8192 |
| WDTCPS_9 | Divider ratio 1:16384 |
| WDTCPS_10 | Divider ratio 1:32768 |
| WDTCPS_11 | Divider ratio 1:65536 |
| WDTCPS_12 | Divider ratio 1:131072 |
| WDTCPS_13 | Divider ratio 1:262144 |
| WDTCPS_14 | Divider ratio 1:524299 |
| WDTCPS_15 | Divider ratio 1:1048576 |
| WDTCPS_16 | Divider ratio 1:2097152 |
| WDTCPS_17 | Divider ratio 1:4194304 |
| WDTCPS_18 | Divider ratio 1:8388608 |
| WDTCPS_19 | Divider ratio 1:32 |
| WDTCPS_20 | Divider ratio 1:32 |
| WDTCPS_21 | Divider ratio 1:32 |
| WDTCPS_22 | Divider ratio 1:32 |
| WDTCPS_23 | Divider ratio 1:32 |
| WDTCPS_24 | Divider ratio 1:32 |
| WDTCPS_25 | Divider ratio 1:32 |
| WDTCPS_26 | Divider ratio 1:32 |
| WDTCPS_27 | Divider ratio 1:32 |
| WDTCPS_28 | Divider ratio 1:32 |
| WDTCPS_29 | Divider ratio 1:32 |
| WDTCPS_30 | Divider ratio 1:32 |
| WDTCPS_31 | Divider ratio 1:65536; software control of WDTPS |
| WDTE | WDT operating mode |
| OFF | WDT Disabled; SWDTEN is ignored |
| SWDTEN | WDT enabled/disabled by SWDTEN bit |
| NSLEEP | WDT enabled while sleep=0, suspended when sleep=1; SWDTEN ignored |
| ON | WDT enabled regardless of sleep |
|
Register: CONFIG3H @ 0x300005
|
|
|---|---|
| WDTCWS | WDT Window Select bits |
| WDTCWS_0 | window delay = 87.5; no software control; keyed access required |
| WDTCWS_1 | window delay = 75 percent of time; no software control; keyed access required |
| WDTCWS_2 | window delay = 62.5 percent of time; no software control; keyed access required |
| WDTCWS_3 | window delay = 50 percent of time; no software control; keyed access required |
| WDTCWS_4 | window delay = 37.5 percent of time; no software control; keyed access required |
| WDTCWS_5 | window delay = 25 percent of time; no software control; keyed access required |
| WDTCWS_6 | window always open (100%); no software control; keyed access required |
| WDTCWS_7 | window always open (100%); software control; keyed access not required |
| WDTCCS | WDT input clock selector |
| LFINTOSC | WDT reference clock is the 31.0 kHz LFINTOSC |
| MFINTOSC | WDT reference clock is the 32kHz MFINTOSC output |
| SOSC | WDT reference clock is SOSC |
| SC | Software Control |
|
Register: CONFIG4L @ 0x300006
|
|
|---|---|
| BBSIZE | Boot Block Size selection bits |
| BBSIZE_512 | Boot Block size is 512 words |
| BBSIZE_1024 | Boot Block size is 1024 words |
| BBSIZE_2048 | Boot Block size is 2048 words |
| BBSIZE_4096 | Boot Block size is 4096 words |
| BBSIZE_8192 | Boot Block size is 8192 words |
| BBEN | Boot Block enable bit |
| OFF | Boot block disabled |
| ON | Boot block enabled |
| SAFEN | Storage Area Flash enable bit |
| OFF | SAF disabled |
| ON | SAF enabled |
| WRTAPP | Application Block write protection bit |
| OFF | Application Block not write protected |
| ON | Application Block write protected |
|
Register: CONFIG4H @ 0x300007
|
|
|---|---|
| WRTB | Boot Block Write Protection bit |
| OFF | Boot Block not write-protected |
| ON | Boot Block write-protected |
| WRTC | Configuration Register Write Protection bit |
| OFF | Configuration registers (300000-30000Bh) not write-protected |
| ON | Configuration registers (300000-30000Bh) write-protected |
| WRTD | Data EEPROM Write Protection bit |
| OFF | Data EEPROM not write-protected |
| ON | Data EEPROM write-protected |
| WRTSAF | SAF Write protection bit |
| OFF | SAF not Write Protected |
| ON | SAF Write Protected |
| LVP | Low Voltage Programming Enable bit |
| OFF | HV on MCLR/VPP must be used for programming |
| ON | Low voltage programming enabled. MCLR/VPP pin function is MCLR. MCLRE configuration bit is ignored |
|
Register: CONFIG5L @ 0x300008
|
|
|---|---|
| CP | PFM and Data EEPROM Code Protection bit |
| OFF | PFM and Data EEPROM code protection disabled |
| ON | PFM and Data EEPROM code protection enabled |
|
Register: CONFIG5H @ 0x300009
|
|---|
|
Register: IDLOC0 @ 0x200000
|
|---|
|
Register: IDLOC1 @ 0x200002
|
|---|
|
Register: IDLOC2 @ 0x200004
|
|---|
|
Register: IDLOC3 @ 0x200006
|
|---|
|
Register: IDLOC4 @ 0x200008
|
|---|
|
Register: IDLOC5 @ 0x20000A
|
|---|
|
Register: IDLOC6 @ 0x20000C
|
|---|
|
Register: IDLOC7 @ 0x20000E
|
|---|
The following table enumerates the IRQ numbers for this device along with descriptions of the interrupt sources. Also shown are the corresponding symbols that can be used as an argument to irq() in the __interrupt() specifier and the macro names that can be used in C source.
For example:__interrupt() specifier usage.
void __interrupt(irq(SWINT)) isr0(void) {
// do stuff
}
For example: macro usage.
void __interrupt(irq(default)) isr1(unsigned char irq) {
switch (irq) {
case IRQ_HLVD:
// do HLVD Interrupt stuff
break;
case IRQ_OSF:
// do Oscillator Failure Interrupt stuff
break;
case IRQ_CSW:
// do Clock Switch Interrupt stuff
break;
default:
// do any other stuff
break;
}
}
| IRQ | __irq() Argument | C Device-header Macro | Description |
|---|---|---|---|
| 0 | SWINT | IRQ_SWINT | Software Interrupt |
| 1 | HLVD | IRQ_HLVD | HLVD Interrupt |
| 2 | OSF | IRQ_OSF | Oscillator Failure Interrupt |
| 3 | CSW | IRQ_CSW | Clock Switch Interrupt |
| 4 | NVM | IRQ_NVM | NVM Interrupt |
| 5 | SCAN | IRQ_SCAN | Scanner Interrupt |
| 6 | CRC | IRQ_CRC | CRC Interrupt |
| 7 | IOC | IRQ_IOC | Interrupt on change |
| 8 | INT0 | IRQ_INT0 | External Interrupt 0 |
| 9 | ZCD | IRQ_ZCD | ZCD Interrupt |
| 10 | AD | IRQ_AD | ADC Interrupt |
| 11 | ADT | IRQ_ADT | ADC Treshold Interrupt |
| 12 | CMP1 | IRQ_CMP1 | Comparator 1 Interrupt |
| 13 | SMT1 | IRQ_SMT1 | SMT1 Interrupt |
| 14 | SMT1PRA | IRQ_SMT1PRA | SMT1 Period acqusition Interrupt |
| 15 | SMT1PWA | IRQ_SMT1PWA | SMT1 Pulse width acqusition Interrupt |
| 16 | DMA1SCNT | IRQ_DMA1SCNT | DMA1 Source count Interrupt |
| 17 | DMA1DCNT | IRQ_DMA1DCNT | DMA1 Destination count Interrupt |
| 18 | DMA1OR | IRQ_DMA1OR | DMA1 Overflow Interrupt |
| 19 | DMA1A | IRQ_DMA1A | DMA1 Abort Interrupt |
| 20 | SPI1RX | IRQ_SPI1RX | SPI1 Receive Interrupt |
| 21 | SPI1TX | IRQ_SPI1TX | SPI1 Transmit Interrupt |
| 22 | SPI1 | IRQ_SPI1 | SPI1 Interrupt |
| 23 | I2C1RX | IRQ_I2C1RX | I2C1 Receive Interrupt |
| 24 | I2C1TX | IRQ_I2C1TX | I2C1 Transmit Interrupt |
| 25 | I2C1 | IRQ_I2C1 | I2C1 Interrupt |
| 26 | I2C1E | IRQ_I2C1E | I2C1 Error Interrupt |
| 27 | U1RX | IRQ_U1RX | UART1 Receive Interrupt |
| 28 | U1TX | IRQ_U1TX | UART1 Transmit Interrupt |
| 29 | U1E | IRQ_U1E | UART1 Error Interrupt |
| 30 | U1 | IRQ_U1 | UART1 Interrupt |
| 31 | TMR0 | IRQ_TMR0 | Timer0 Interrupt |
| 32 | TMR1 | IRQ_TMR1 | Timer1 Interrupt |
| 33 | TMR1G | IRQ_TMR1G | Timer1 Gate Interrupt |
| 34 | TMR2 | IRQ_TMR2 | Timer2 Interrupt |
| 35 | CCP1 | IRQ_CCP1 | CCP1 Interrupt |
| 36 | NCO1 | IRQ_NCO1 | NCO1 Interrupt |
| 37 | CWG1 | IRQ_CWG1 | CWG1 Interrupt |
| 38 | CLC1 | IRQ_CLC1 | CLC1 Interrupt |
| 39 | INT1 | IRQ_INT1 | External Interrupt 1 |
| 40 | RXB0IF | IRQ_RXB0IF | CAN Receive Buffer 0 /CAN FIFO full Interrupt |
| 41 | RXB1IF | IRQ_RXB1IF | CAN Receive Buffer 1/CAN Receive Buffer n Interrupt |
| 42 | TXB0IF | IRQ_TXB0IF | CAN Transmit Buffer 0 Interrupt |
| 43 | TXB1IF | IRQ_TXB1IF | CAN Transmit Buffer 1 Interrupt |
| 44 | TXB2IF | IRQ_TXB2IF | CAN Transmit Buffer 2/CAN Transmit Buffer n Interrupt |
| 45 | ERRIF | IRQ_ERRIF | CAN Error Interrupt |
| 46 | WAKIF | IRQ_WAKIF | CAN Bus Wake Up Activity Interrupt |
| 47 | IRXIF | IRQ_IRXIF | CAN Invalid Message Received Interrupt |
| 48 | CMP2 | IRQ_CMP2 | Comparator 2 Interrupt |
| 49 | SMT2 | IRQ_SMT2 | SMT2 Interrupt |
| 50 | SMT2PRA | IRQ_SMT2PRA | SMT2 Period Acquisition Interrupt |
| 51 | SMT2PWA | IRQ_SMT2PWA | SMT2 Pulse width acqusition Interrupt |
| 52 | DMA2SCNT | IRQ_DMA2SCNT | DMA2 Source count Interrupt |
| 53 | DMA2DCNT | IRQ_DMA2DCNT | DMA2 Destination count Interrupt |
| 54 | DMA2OR | IRQ_DMA2OR | DMA2 Overflow Interrupt |
| 55 | DMA2A | IRQ_DMA2A | DMA2 Abort Interrupt |
| 56 | I2C2RX | IRQ_I2C2RX | I2C2 Receive Interrupt |
| 57 | I2C2TX | IRQ_I2C2TX | I2C2 Transmit Interrupt |
| 58 | I2C2 | IRQ_I2C2 | I2C2 Interrupt |
| 59 | I2C2E | IRQ_I2C2E | I2C2 Error Interrupt |
| 60 | U2RX | IRQ_U2RX | UART2 Receive Interrupt |
| 61 | U2TX | IRQ_U2TX | UART2 Transmit Interrupt |
| 62 | U2E | IRQ_U2E | UART2 Error Interrupt |
| 63 | U2 | IRQ_U2 | UART2 Interrupt |
| 64 | TMR3 | IRQ_TMR3 | Timer3 Interrupt |
| 65 | TMR3G | IRQ_TMR3G | Timer3 Gate Interrupt |
| 66 | TMR4 | IRQ_TMR4 | Timer4 Interrupt |
| 67 | CCP2 | IRQ_CCP2 | CCP2 Interrupt |
| 68 | CWG2 | IRQ_CWG2 | CWG2 Interrupt |
| 69 | CLC2 | IRQ_CLC2 | CLC2 Interrupt |
| 70 | INT2 | IRQ_INT2 | External Interrupt 2 |
| 71 | TMR5 | IRQ_TMR5 | Timer5 Interrupt |
| 72 | TMR5G | IRQ_TMR5G | Timer5 Gate Interrupt |
| 73 | TMR6 | IRQ_TMR6 | Timer6 Interrupt |
| 74 | CCP3 | IRQ_CCP3 | CCP3 Interrupt |
| 75 | CWG3 | IRQ_CWG3 | CWG3 Interrupt |
| 76 | CLC3 | IRQ_CLC3 | CLC3 Interrupt |
| 77 | CCP4 | IRQ_CCP4 | CCP4 Interrupt |
| 78 | CLC4 | IRQ_CLC4 | CLC4 Interrupt |