18F24Q71 Support Information

XC8-CC #pragma config Usage

#pragma config <setting>=<named value>
For example:
// External Oscillator Selection : EC (external clock) above 8 MHz
// Reset Oscillator Selection : EXTOSC operating per FEXTOSC bits (device manufacturing default)
#pragma config FEXTOSC = ECH, RSTOSC = EXTOSC
#pragma config <setting>=<literal constant>
For example:
// External Oscillator Selection : EC (external clock) above 8 MHz
// Reset Oscillator Selection : EXTOSC operating per FEXTOSC bits (device manufacturing default)
#pragma config FEXTOSC = 0x7, RSTOSC = 0x7
#pragma config <register>=<literal constant>
For example:
// External Oscillator Selection : EC (external clock) above 8 MHz
// Reset Oscillator Selection : EXTOSC operating per FEXTOSC bits (device manufacturing default)
#pragma config CONFIG1 = 0xFF
For example:
// IDLOC @ 0x200000
#pragma config IDLOC0 = 0x65535

PIC-AS config Usage

config "<setting>"="<named value>"
For example:
; External Oscillator Selection : EC (external clock) above 8 MHz
; Reset Oscillator Selection : EXTOSC operating per FEXTOSC bits (device manufacturing default)
config "FEXTOSC" = "ECH", "RSTOSC" = "EXTOSC"
config "<setting>"=<literal constant>
For example:
; External Oscillator Selection : EC (external clock) above 8 MHz
; Reset Oscillator Selection : EXTOSC operating per FEXTOSC bits (device manufacturing default)
config "FEXTOSC" = 0x7, "RSTOSC" = 0x7
config "<register>"=<literal constant>
For example:
; External Oscillator Selection : EC (external clock) above 8 MHz
; Reset Oscillator Selection : EXTOSC operating per FEXTOSC bits (device manufacturing default)
config "CONFIG1" = 0xFF
For example:
; IDLOC @ 0x200000
config "IDLOC0" = 0x65535

Configuration Registers & Settings

Register: CONFIG1 @ 0x300000
FEXTOSC External Oscillator Selection
LP LP (crystal oscillator) optimized for 32.768 kHz
XT XT (crystal oscillator) above 100 kHz, below 8 MHz
HS HS (crystal oscillator) above 8 MHz
OFF Oscillator not enabled
ECL EC (external clock) below 100 kHz
ECM EC (external clock) for 500 kHz to 8 MHz
ECH EC (external clock) above 8 MHz
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: CONFIG2 @ 0x300001
CLKOUTEN Clock out Enable bit
OFF CLKOUT function is disabled
ON CLKOUT function is enabled
PR1WAY PRLOCKED One-Way Set Enable bit
ON PRLOCKED bit can be cleared and set only once
OFF PRLOCKED bit can be set and cleared repeatedly
BBEN Boot Block enable bit
OFF Boot block disabled
ON Boot block enabled
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
FCMENP Fail-Safe Clock Monitor - Primary XTAL Enable bit
OFF Fail-Safe Clock Monitor Disabled
ON Fail-Safe Clock Monitor enabled; timer will flag FSCMP bit and OSFIF interrupt on EXTOSC failure.
FCMENS Fail-Safe Clock Monitor - Secondary XTAL Enable bit
OFF Fail-Safe Clock Monitor Disabled
ON Fail-Safe Clock Monitor enabled; timer will flag FSCMP bit and OSFIF interrupt on SOSC failure.
Register: CONFIG3 @ 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 IVTLOCKED bit can be cleared and set only once
OFF IVTLOCKED bit can be cleared and set repeatedly
LPBOREN Low Power BOR Enable bit
OFF Low-Power BOR disabled
ON Low-Power BOR 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: CONFIG4 @ 0x300003
BORV Brown-out Reset Voltage Selection bits
VBOR_1P9 Brown-out Reset Voltage (VBOR) set to 1.9V
VBOR_2P45 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.85V
ZCD ZCD Disable bit
OFF ZCD module is disabled. ZCD can be enabled by setting the ZCDSEN bit of ZCDCON
ON ZCD module is always enabled; ZCDMD and ZCDSEN bits are ignored
PPS1WAY PPSLOCK bit One-Way Set Enable bit
ON PPSLOCKED bit can be cleared and set only once; PPS registers remain locked after one clear/set cycle
OFF PPSLOCKED 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
LVP Low Voltage Programming Enable bit
ON Low voltage programming enabled. MCLR/VPP pin function is MCLR. MCLRE configuration bit is ignored
OFF HV on MCLR/VPP must be used for programming
DEBUG Background Debugger
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: CONFIG5 @ 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; SWDTEN is ignored
Register: CONFIG6 @ 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: CONFIG7 @ 0x300006
BBSIZE Boot Block Size Selection bits
BBSIZE_4096 Boot Block size is 4096 words
BBSIZE_3968 Boot Block size is 3968 words
BBSIZE_3840 Boot Block size is 3840 words
BBSIZE_3712 Boot Block size is 3712 words
BBSIZE_3584 Boot Block size is 3584 words
BBSIZE_3456 Boot Block size is 3456 words
BBSIZE_3328 Boot Block size is 3328 words
BBSIZE_3200 Boot Block size is 3200 words
BBSIZE_3072 Boot Block size is 3072 words
BBSIZE_2944 Boot Block size is 2944 words
BBSIZE_2816 Boot Block size is 2816 words
BBSIZE_2688 Boot Block size is 2688 words
BBSIZE_2560 Boot Block size is 2560 words
BBSIZE_2432 Boot Block size is 2432 words
BBSIZE_2304 Boot Block size is 2304 words
BBSIZE_2176 Boot Block size is 2176 words
BBSIZE_2048 Boot Block size is 2048 words
BBSIZE_1920 Boot Block size is 1920 words
BBSIZE_1792 Boot Block size is 1792 words
BBSIZE_1664 Boot Block size is 1664 words
BBSIZE_1536 Boot Block size is 1536 words
BBSIZE_1408 Boot Block size is 1408 words
BBSIZE_1280 Boot Block size is 1280 words
BBSIZE_1152 Boot Block size is 1152 words
BBSIZE_1024 Boot Block size is 1024 words
BBSIZE_896 Boot Block size is 896 words
BBSIZE_768 Boot Block size is 768 words
BBSIZE_640 Boot Block size is 640 words
BBSIZE_512 Boot Block size is 512 words
BBSIZE_384 Boot Block size is 384 words
BBSIZE_256 Boot Block size is 256 words
BBSIZE_128 Boot Block size is 128 words
Register: CONFIG8 @ 0x300007
SAFSZ SAF Block Size Selection bits
SAFSZ_NONE NONE
SAFSZ_128 Last 128 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
SAFSZ_256 Last 256 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
SAFSZ_384 Last 384 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
SAFSZ_512 Last 512 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
SAFSZ_640 Last 640 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
SAFSZ_768 Last 768 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
SAFSZ_896 Last 896 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
SAFSZ_1024 Last 1024 words of PFM; self write operation depends on WRTSAF bit in CONFIG9
Register: CONFIG9 @ 0x300008
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 not Write protected
ON Configuration registers 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
WRTAPP Application Block write protection bit
OFF Application Block not write protected
ON Application Block write protected
Register: CONFIG10 @ 0x300009
CPD Data EEPROM Code Protection bit
OFF Data EEPROM code protection disabled
ON Data EEPROM code protection enabled
Register: CONFIG11 @ 0x30000A
CP PFM Code Protection bit
OFF PFM code protection disabled
ON PFM code protection enabled
Register: IDLOC0 @ 0x200000
Register: IDLOC1 @ 0x200002
Register: IDLOC2 @ 0x200004
Register: IDLOC3 @ 0x200006
Register: IDLOC4 @ 0x200008
Register: IDLOC5 @ 0x20000A
Register: IDLOC6 @ 0x20000C
Register: IDLOC7 @ 0x20000E
Register: IDLOC8 @ 0x200010
Register: IDLOC9 @ 0x200012
Register: IDLOC10 @ 0x200014
Register: IDLOC11 @ 0x200016
Register: IDLOC12 @ 0x200018
Register: IDLOC13 @ 0x20001A
Register: IDLOC14 @ 0x20001C
Register: IDLOC15 @ 0x20001E
Register: IDLOC16 @ 0x200020
Register: IDLOC17 @ 0x200022
Register: IDLOC18 @ 0x200024
Register: IDLOC19 @ 0x200026
Register: IDLOC20 @ 0x200028
Register: IDLOC21 @ 0x20002A
Register: IDLOC22 @ 0x20002C
Register: IDLOC23 @ 0x20002E
Register: IDLOC24 @ 0x200030
Register: IDLOC25 @ 0x200032
Register: IDLOC26 @ 0x200034
Register: IDLOC27 @ 0x200036
Register: IDLOC28 @ 0x200038
Register: IDLOC29 @ 0x20003A
Register: IDLOC30 @ 0x20003C
Register: IDLOC31 @ 0x20003E

Interrupt Sources

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 CLC1 IRQ_CLC1 CLC1 Interrupt
6 CRC IRQ_CRC CRC Interrupt
7 IOC IRQ_IOC Interrupt on change
8 INT0 IRQ_INT0 External Interrupt 0
9 ADCH1 IRQ_ADCH1 ADC Threshold Interrupt-Context 0
10 AD IRQ_AD ADC Interrupt
11 ACT IRQ_ACT Active Clock Tuning Interrupt
12 CMP1 IRQ_CMP1 Comparator 1 Interrupt
13 ADCH2 IRQ_ADCH2 ADC Threshold Interrupt-Context 1
14 ADCH3 IRQ_ADCH3 ADC Threshold Interrupt-Context 2
15 ADCH4 IRQ_ADCH4 ADC Threshold Interrupt-Context 3
16 ZCD IRQ_ZCD ZCD Interrupt
17 CLC5 IRQ_CLC5 CLC5 Interrupt
18 IOCSR IRQ_IOCSR Signal Routing Port Interrupt on Change
20 DMA1SCNT IRQ_DMA1SCNT DMA1 Source count Interrupt
21 DMA1DCNT IRQ_DMA1DCNT DMA1 Destination count Interrupt
22 DMA1OR IRQ_DMA1OR DMA1 Overflow Interrupt
23 DMA1A IRQ_DMA1A DMA1 Abort Interrupt
24 SPI1RX IRQ_SPI1RX SPI1 Receive Interrupt
25 SPI1TX IRQ_SPI1TX SPI1 Transmit Interrupt
26 SPI1 IRQ_SPI1 SPI1 Interrupt
27 TMR2 IRQ_TMR2 Timer2 Interrupt
28 TMR1 IRQ_TMR1 Timer1 Interrupt
29 TMR1G IRQ_TMR1G Timer1 Gate Interrupt
30 CCP1 IRQ_CCP1 CCP1 Interrupt
31 TMR0 IRQ_TMR0 Timer0 Interrupt
32 U1RX IRQ_U1RX UART1 Receive Interrupt
33 U1TX IRQ_U1TX UART1 Transmit Interrupt
34 U1E IRQ_U1E UART1 Error Interrupt
35 U1 IRQ_U1 UART1 Interrupt
36 TMR3 IRQ_TMR3 Timer3 Interrupt
37 TMR3G IRQ_TMR3G Timer3 Gate Interrupt
38 PWM1PR IRQ_PWM1PR PWM1 Period Interrupt
39 PWM1 IRQ_PWM1 PWM1 Interrupt
41 CLC6 IRQ_CLC6 CLC5 Interrupt
44 CMP2 IRQ_CMP2 Comparator 2 Interrupt
42 TU16A IRQ_TU16A Universal Timer 16A Interrupt
45 CLC2 IRQ_CLC2 CLC2 Interrupt
46 PWM2PR IRQ_PWM2PR PWM2 Period Interrupt
47 PWM2 IRQ_PWM2 PWM2 Interrupt
48 INT1 IRQ_INT1 External Interrupt 1
49 CLC7 IRQ_CLC7 CLC7 Interrupt
50 CWG1 IRQ_CWG1 CWG1 Interrupt
51 NCO1 IRQ_NCO1 NCO1 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 I2C1RX IRQ_I2C1RX I2C1 Receive Interrupt
57 I2C1TX IRQ_I2C1TX I2C1 Transmit Interrupt
58 I2C1 IRQ_I2C1 I2C1 Interrupt
59 I2C1E IRQ_I2C1E I2C1 Error Interrupt
61 CLC3 IRQ_CLC3 CLC3 Interrupt
62 PWM3PR IRQ_PWM3PR PWM3 Period Interrupt
63 PWM3 IRQ_PWM3 PWM3 Interrupt
64 U2RX IRQ_U2RX UART2 Receive Interrupt
65 U2TX IRQ_U2TX UART2 Transmit Interrupt
66 U2E IRQ_U2E UART2 Error Interrupt
67 U2 IRQ_U2 UART2 Interrupt
69 CLC4 IRQ_CLC4 CLC4 Interrupt
71 SCAN IRQ_SCAN Scanner Interrupt
76 DMA3SCNT IRQ_DMA3SCNT DMA3 Source count Interrupt
77 DMA3DCNT IRQ_DMA3DCNT DMA3 Destination count Interrupt
78 DMA3OR IRQ_DMA3OR DMA3 Overflow Interrupt
79 DMA3A IRQ_DMA3A DMA3 Abort Interrupt
80 INT2 IRQ_INT2 External Interrupt 2
81 CLC8 IRQ_CLC8 CLC8 Interrupt
82 TU16B IRQ_TU16B Universal Timer 16B Interrupt
83 TMR4 IRQ_TMR4 Timer4 Interrupt
84 DMA4SCNT IRQ_DMA4SCNT DMA4 Source count Interrupt
85 DMA4DCNT IRQ_DMA4DCNT DMA4 Destination count Interrupt
86 DMA4OR IRQ_DMA4OR DMA4 Overflow Interrupt
87 DMA4A IRQ_DMA4A DMA4 Abort Interrupt
70 CCP2 IRQ_CCP2 CCP2 Interrupt