2.0 GUIDELINES FOR GETTING STARTED WITH 16-BIT MICROCONTROLLERS
2.1 Basic Connection Requirements
Getting started with the PIC24FJ64GA004 family of 16-bit microcontrollers requires attention to a minimal set of device pin connections before proceeding with development.
The following pins must always be connected:
- All VDD and VSS pins (see Section 2.2 “Power Supply Pins”)
- All AVDD and AVSS pins, regardless of whether or not the analog device features are used (see Section 2.2 “Power Supply Pins”)
- MCLR pin (see Section 2.3 “Master Clear (MCLR) Pin”)
- ENVREG/DISVREG and VCAP/VDDCORE pins (PIC24F J devices only) (see Section 2.4 “Voltage Regulator Pins (ENVREG/DISVREG and VCAP/VDDCORE)”)
These pins must also be connected if they are being used in the end application:
- PGECx/PGEDx pins used for In-Circuit Serial Programming™ (ICSP™) and debugging purposes (see Section 2.5 “ICSP Pins”)
- OSC1 and OSCO pins when an external oscillator source is used (see Section 2.6 “External Oscillator Pins”)
Additionally, the following pins may be required:
- VREF+/VREF- pins used when external voltage reference for analog modules is implemented
Note: The AVDD and AVSS pins must always be connected, regardless of whether any of the analog modules are being used.
The minimum mandatory connections are shown in Figure 2-1.
FIGURE 2-1: RECOMMENDED MINIMUM CONNECTIONS

Key (all values are recommendations): C1 through C6: 0.1 µF, 20V ceramic C7: 10 µF, 6.3V or greater, tantalum or ceramic R1: 10 kΩ R2: 100Ω to 470Ω
Note 1: See Section 2.4 “Voltage Regulator Pins (ENVREG/DISVREG and VCAP/VDDCORE)” for an explanation of the ENVREG/DISVREG pin connections. 2: The example shown is for a PIC24F device with five VDD/VSS and AVDD/AVSS pairs. Other devices may have more or less pairs; adjust the number of decoupling capacitors appropriately.
2.2 Power Supply Pins
2.2.1 DECOUPLING CAPACITORS
The use of decoupling capacitors on every pair of power supply pins, such as VDD, VSS, AVDD and AVSS is required.
Consider the following criteria when using decoupling capacitors:
- Value and type of capacitor: A 0.1 µF (100 nF), 10-20V capacitor is recommended. The capacitor should be a low-ESR device with a resonance frequency in the range of 200 MHz and higher. Ceramic capacitors are recommended.
- Placement on the printed circuit board: The decoupling capacitors should be placed as close to the pins as possible. It is recommended to place the capacitors on the same side of the board as the device. If space is constricted, the capacitor can be placed on another layer on the PCB using a via; however, ensure that the trace length from the pin to the capacitor is no greater than 0.25 inch (6 mm).
- Handling high-frequency noise: If the board is experiencing high-frequency noise (upward of tens of MHz), add a second ceramic type capacitor in parallel to the above described decoupling capacitor. The value of the second capacitor can be in the range of 0.01 µF to 0.001 µF. Place this second capacitor next to each primary decoupling capacitor. In high-speed circuit designs, consider implementing a decade pair of capacitances as close to the power and ground pins as possible (e.g., 0.1 µF in parallel with 0.001 µF).
- Maximizing performance: On the board layout from the power supply circuit, run the power and return traces to the decoupling capacitors first, and then to the device pins. This ensures that the decoupling capacitors are first in the power chain. Equally important is to keep the trace length between the capacitor and the power pins to a minimum, thereby reducing PCB trace inductance.
2.2.2 TANK CAPACITORS
On boards with power traces running longer than six inches in length, it is suggested to use a tank capacitor for integrated circuits including microcontrollers to supply a local power source. The value of the tank capacitor should be determined based on the trace resistance that connects the power supply source to the device, and the maximum current drawn by the device in the application. In other words, select the tank capacitor so that it meets the acceptable voltage sag at the device. Typical values range from 4.7 µF to 47 µF.
2.3 Master Clear (MCLR) Pin
The MCLR pin provides two specific device functions: device Reset, and device programming and debugging. If programming and debugging are not required in the end application, a direct connection to VDD may be all that is required. The addition of other components, to help increase the application's resistance to spurious Resets from voltage sags, may be beneficial. A typical configuration is shown in Figure 2-1. Other circuit designs may be implemented, depending on the application's requirements.
During programming and debugging, the resistance and capacitance that can be added to the pin must be considered. Device programmers and debuggers drive the MCLR pin. Consequently, specific voltage levels ($V_{IH}$ and $V_{IL}$) and fast signal transitions must not be adversely affected. Therefore, specific values of R1 and C1 will need to be adjusted based on the application and PCB requirements. For example, it is recommended that the capacitor, C1, be isolated from the MCLR pin during programming and debugging operations by using a jumper (Figure 2-2). The jumper is replaced for normal run-time operations.
Any components associated with the MCLR pin should be placed within 0.25 inch (6 mm) of the pin.
FIGURE 2-2: EXAMPLE OF MCLR PIN CONNECTIONS

Note 1: R1 ≤ 10 k\Omega is recommended. A suggested starting value is 10 k\Omega. Ensure that the MCLR pin $V_{IH}$ and $V_{IL}$ specifications are met.
2: R2 ≤ 470\Omega will limit any current flowing into MCLR from the external capacitor, C, in the event of MCLR pin breakdown, due to Electrostatic Discharge (ESD) or Electrical Overstress (EOS). Ensure that the MCLR pin $V_{IH}$ and $V_{IL}$ specifications are met.
DS39881E-page 18 © 2010-2013 Microchip Technology Inc.
2.4 Voltage Regulator Pins (ENVREG/DISVREG and VCAP/VDDCORE)
Note: This section applies only to PIC24F J devices with an on-chip voltage regulator.
The on-chip voltage regulator enable/disable pin (ENVREG or DISVREG, depending on the device family) must always be connected directly to either a supply voltage or to ground. The particular connection is determined by whether or not the regulator is to be used:
- For ENVREG, tie to VDD to enable the regulator, or to ground to disable the regulator
- For DISVREG, tie to ground to enable the regulator or to VDD to disable the regulator
Refer to Section 24.2 “On-Chip Voltage Regulator” for details on connecting and using the on-chip regulator.
When the regulator is enabled, a low-ESR (< 5Ω) capacitor is required on the VCAP/VDDCORE pin to stabilize the voltage regulator output voltage. The VCAP/VDDCORE pin must not be connected to VDD and must use a capacitor of 10 µF connected to ground. The type can be ceramic or tantalum. Suitable examples of capacitors are shown in Table 2-1. Capacitors with equivalent specification can be used.
Designers may use Figure 2-3 to evaluate ESR equivalence of candidate devices.
The placement of this capacitor should be close to VCAP/VDDCORE. It is recommended that the trace length not exceed 0.25 inch (6 mm). Refer to Section 27.0 “Electrical Characteristics” for additional information.
When the regulator is disabled, the VCAP/VDDCORE pin must be tied to a voltage supply at the VDDCORE level. Refer to Section 27.0 “Electrical Characteristics” for information on VDD and VDDCORE.
FIGURE 2-3: FREQUENCY vs. ESR PERFORMANCE FOR SUGGESTED VCAP

Note: Typical data measurement at 25°C, 0V DC bias.
TABLE 2-1: SUITABLE CAPACITOR EQUIVALENTS
2.4.1 CONSIDERATIONS FOR CERAMIC CAPACITORS
In recent years, large value, low-voltage, surface-mount ceramic capacitors have become very cost effective in sizes up to a few tens of microfarad. The low-ESR, small physical size and other properties make ceramic capacitors very attractive in many types of applications.
Ceramic capacitors are suitable for use with the internal voltage regulator of this microcontroller. However, some care is needed in selecting the capacitor to ensure that it maintains sufficient capacitance over the intended operating range of the application.
Typical low-cost, 10 µF ceramic capacitors are available in X5R, X7R and Y5V dielectric ratings (other types are also available, but are less common). The initial tolerance specifications for these types of capacitors are often specified as ±10% to ±20% (X5R and X7R), or -20%/+80% (Y5V). However, the effective capacitance that these capacitors provide in an application circuit will also vary based on additional factors, such as the applied DC bias voltage and the temperature. The total in-circuit tolerance is, therefore, much wider than the initial tolerance specification.
The X5R and X7R capacitors typically exhibit satisfactory temperature stability (ex: ±15% over a wide temperature range, but consult the manufacturer's data sheets for exact specifications). However, Y5V capacitors typically have extreme temperature tolerance specifications of +22%/-82%. Due to the extreme temperature tolerance, a 10 µF nominal rated Y5V type capacitor may not deliver enough total capacitance to meet minimum internal voltage regulator stability and transient response requirements. Therefore, Y5V capacitors are not recommended for use with the internal regulator if the application must operate over a wide temperature range.
In addition to temperature tolerance, the effective capacitance of large value ceramic capacitors can vary substantially, based on the amount of DC voltage applied to the capacitor. This effect can be very significant, but is often overlooked or is not always documented.
Typical DC bias voltage vs. capacitance graph for X7R type capacitors is shown in Figure 2-4.
FIGURE 2-4: DC BIAS VOLTAGE vs. CAPACITANCE CHARACTERISTICS

When selecting a ceramic capacitor to be used with the internal voltage regulator, it is suggested to select a high-voltage rating, so that the operating voltage is a small percentage of the maximum rated capacitor voltage. For example, choose a ceramic capacitor rated at 16V for the 2.5V or 1.8V core voltage. Suggested capacitors are shown in Table 2-1.
2.5 ICSP Pins
The PGECx and PGEDx pins are used for In-Circuit Serial Programming (ICSP) and debugging purposes. It is recommended to keep the trace length between the ICSP connector and the ICSP pins on the device as short as possible. If the ICSP connector is expected to experience an ESD event, a series resistor is recommended, with the value in the range of a few tens of ohms, not to exceed 100Ω.
Pull-up resistors, series diodes and capacitors on the PGECx and PGEDx pins are not recommended as they will interfere with the programmer/debugger communications to the device. If such discrete components are an application requirement, they should be removed from the circuit during programming and debugging. Alternatively, refer to the AC/DC characteristics and timing requirements information in the respective device Flash programming specification for information on capacitive loading limits and pin input voltage high ($V_{IH}$) and input low ($V_{IL}$) requirements.
For device emulation, ensure that the "Communication Channel Select" (i.e., PGECx/PGEDx pins), programmed into the device, matches the physical connections for the ICSP to the Microchip debugger/emulator tool.
For more information on available Microchip development tools connection requirements, refer to Section 25.0 "Development Support".
2.6 External Oscillator Pins
Many microcontrollers have options for at least two oscillators: a high-frequency primary oscillator and a low-frequency secondary oscillator (refer to Section 8.0 "Oscillator Configuration" for details).
The oscillator circuit should be placed on the same side of the board as the device. Place the oscillator circuit close to the respective oscillator pins with no more than 0.5 inch (12 mm) between the circuit components and the pins. The load capacitors should be placed next to the oscillator itself, on the same side of the board.
Use a grounded copper pour around the oscillator circuit to isolate it from surrounding circuits. The grounded copper pour should be routed directly to the MCU ground. Do not run any signal traces or power traces inside the ground pour. Also, if using a two-sided board, avoid any traces on the other side of the board where the crystal is placed.
Layout suggestions are shown in Figure 2-5. In-line packages may be handled with a single-sided layout that completely encompasses the oscillator pins. With fine-pitch packages, it is not always possible to completely surround the pins and components. A suitable solution is to tie the broken guard sections to a mirrored ground layer. In all cases, the guard trace(s) must be returned to ground.
In planning the application's routing and I/O assignments, ensure that adjacent port pins, and other signals in close proximity to the oscillator, are benign (i.e., free of high frequencies, short rise and fall times and other similar noise).
For additional information and design guidance on oscillator circuits, please refer to these Microchip Application Notes, available at the corporate web site (www.microchip.com):
- AN826, "Crystal Oscillator Basics and Crystal Selection for rfPIC™ and PICmicro® Devices"
- AN849, "Basic PICmicro® Oscillator Design"
- AN943, "Practical PICmicro® Oscillator Analysis and Design"
- AN949, "Making Your Oscillator Work"
FIGURE 2-5: SUGGESTED PLACEMENT OF THE OSCILLATOR CIRCUIT

2.7 Configuration of Analog and Digital Pins During ICSP Operations
If an ICSP compliant emulator is selected as a debugger, it automatically initializes all of the A/D input pins (ANx) as “digital” pins. Depending on the particular device, this is done by setting all bits in the ADnPCFG register(s), or clearing all bit in the ANSx registers.
All PIC24F devices will have either one or more ADnPCFG registers or several ANSx registers (one for each port); no device will have both. Refer to Section 21.0 “10-Bit High-Speed A/D Converter” for more specific information.
The bits in these registers that correspond to the A/D pins that initialized the emulator must not be changed by the user application firmware; otherwise, communication errors will result between the debugger and the device.
If your application needs to use certain A/D pins as analog input pins during the debug session, the user application must modify the appropriate bits during initialization of the A/D module, as follows:
- For devices with an ADnPCFG register, clear the bits corresponding to the pin(s) to be configured as analog. Do not change any other bits, particularly those corresponding to the PGECx/PGEDx pair, at any time.
- For devices with ANSx registers, set the bits corresponding to the pin(s) to be configured as analog. Do not change any other bits, particularly those corresponding to the PGECx/PGEDx pair, at any time.
When a Microchip debugger/emulator is used as a programmer, the user application firmware must correctly configure the ADnPCFG or ANSx registers. Automatic initialization of this register is only done during debugger operation. Failure to correctly configure the register(s) will result in all A/D pins being recognized as analog input pins, resulting in the port value being read as a logic ‘0’, which may affect user application functionality.
2.8 Unused I/Os
Unused I/O pins should be configured as outputs and driven to a logic low state. Alternatively, connect a 1 kΩ to 10 kΩ resistor to VSS on unused pins and drive the output to logic low.
3.0 CPU
Note: This data sheet summarizes the features of this group of PIC24F devices. It is not intended to be a comprehensive reference source. For more information, refer to the “PIC24F Family Reference Manual”, “CPU” (DS39703).
The PIC24F CPU has a 16-bit (data) modified Harvard architecture with an enhanced instruction set and a 24-bit instruction word with a variable length opcode field. The Program Counter (PC) is 23 bits wide and addresses up to 4M instructions of user program memory space. A single-cycle instruction prefetch mechanism is used to help maintain throughput and provides predictable execution. All instructions execute in a single cycle, with the exception of instructions that change the program flow, the double-word move (MOV.D) instruction and the table instructions. Overhead-free program loop constructs are supported using the REPEAT instructions, which are interruptible at any point.
PIC24F devices have sixteen, 16-bit working registers in the programmer’s model. Each of the working registers can act as a data, address or address offset register. The 16th working register (W15) operates as a Software Stack Pointer for interrupts and calls.
The upper 32 Kbytes of the data space memory map can optionally be mapped into program space at any 16K word boundary defined by the 8-bit Program Space Visibility Page Address (PSVPAG) register. The program to data space mapping feature lets any instruction access program space as if it were data space.
The Instruction Set Architecture (ISA) has been significantly enhanced beyond that of the PIC18, but maintains an acceptable level of backward compatibility. All PIC18 instructions and addressing modes are supported, either directly, or through simple macros. Many of the ISA enhancements have been driven by compiler efficiency needs.
The core supports Inherent (no operand), Relative, Literal, Memory Direct and three groups of addressing modes. All modes support Register Direct and various Register Indirect modes. Each group offers up to seven addressing modes. Instructions are associated with predefined addressing modes depending upon their functional requirements.
For most instructions, the core is capable of executing a data (or program data) memory read, a working register (data) read, a data memory write and a program (instruction) memory read per instruction cycle. As a result, three parameter instructions can be supported, allowing trinary operations (that is, A + B = C) to be executed in a single cycle.
A high-speed, 17-bit by 17-bit multiplier has been included to significantly enhance the core arithmetic capability and throughput. The multiplier supports Signed, Unsigned and Mixed mode, 16-bit by 16-bit or 8-bit by 8-bit, integer multiplication. All multiply instructions execute in a single cycle.
The 16-bit ALU has been enhanced with integer divide assist hardware that supports an iterative non-restoring divide algorithm. It operates in conjunction with the REPEAT instruction looping mechanism and a selection of iterative divide instructions to support 32-bit (or 16-bit), divided by 16-bit, integer signed and unsigned division. All divide operations require 19 cycles to complete, but are interruptible at any cycle boundary.
The PIC24F has a vectored exception scheme with up to 8 sources of non-maskable traps and up to 118 interrupt sources. Each interrupt source can be assigned to one of seven priority levels.
A “block diagram of the CPU is shown in Figure 3-1.
3.1 Programmer’s Model
The programmer’s model for the PIC24F is shown in Figure 3-2. All registers in the programmer’s model are memory mapped and can be manipulated directly by instructions. A description of each register is provided in Table 3-1. All registers associated with the programmer’s model are memory mapped.
FIGURE 3-1: PIC24F CPU CORE BLOCK DIAGRAM

TABLE 3-1: CPU CORE REGISTERS
| Register(s) Name | Description |
|---|---|
| W0 through W15 | Working Register Array |
| PC | 23-Bit Program Counter |
| SR | ALU STATUS Register |
| SPLIM | Stack Pointer Limit Value Register |
| TBLPAG | Table Memory Page Address Register |
| PSVPAG | Program Space Visibility Page Address Register |
| RCOUNT | Repeat Loop Counter Register |
| CORCON | CPU Control Register |
FIGURE 3-2: PROGRAMMER’S MODEL

3.2 CPU Control Registers
REGISTER 3-1: SR: ALU STATUS REGISTER
| U-0 | U-0 | U-0 | U-0 | U-0 | U-0 | U-0 | R/W-0 |
|---|---|---|---|---|---|---|---|
| — | — | — | — | — | — | — | DC |
| bit 15 | bit 8 |
| R/W-0(1) | R/W-0(1) | R/W-0(1) | R-0 | R/W-0 | R/W-0 | R/W-0 | R/W-0 |
|---|---|---|---|---|---|---|---|
| IPL2(2) | IPL1(2) | IPL0(2) | RA | N | OV | Z | C |
| bit 7 | bit 0 |
Legend: R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’ -n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
bit 15-9 Unimplemented: Read as ‘0’
bit 8 DC: ALU Half Carry/Borrow bit 1 = A carry-out from the 4th low-order bit (for byte-sized data) or 8th low-order bit (for word-sized data) of the result occurred 0 = No carry-out from the 4th or 8th low-order bit of the result has occurred
bit 7-5 IPL<2:0>: CPU Interrupt Priority Level Status bits(1,2) 111 = CPU Interrupt Priority Level is 7 (15); user interrupts are disabled 110 = CPU Interrupt Priority Level is 6 (14) 101 = CPU Interrupt Priority Level is 5 (13) 100 = CPU Interrupt Priority Level is 4 (12) 011 = CPU Interrupt Priority Level is 3 (11) 010 = CPU Interrupt Priority Level is 2 (10) 001 = CPU Interrupt Priority Level is 1 (9) 000 = CPU Interrupt Priority Level is 0 (8)
bit 4 RA: REPEAT Loop Active bit 1 = REPEAT loop in progress 0 = REPEAT loop not in progress
bit 3 N: ALU Negative bit 1 = Result was negative 0 = Result was non-negative (zero or positive)
bit 2 OV: ALU Overflow bit 1 = Overflow occurred for signed (2’s complement) arithmetic in this arithmetic operation 0 = No overflow has occurred
bit 1 Z: ALU Zero bit 1 = An operation which effects the Z bit has set it at some time in the past 0 = The most recent operation which effects the Z bit has cleared it (i.e., a non-zero result)
bit 0 C: ALU Carry/Borrow bit 1 = A carry-out from the Most Significant bit of the result occurred 0 = No carry-out from the Most Significant bit of the result occurred
Note 1: The IPL Status bits are read-only when NSTDIS (INTCON1<15>) = 1. 2: The IPL Status bits are concatenated with the IPL3 bit (CORCON<3>) to form the CPU Interrupt Priority Level (IPL). The value in parentheses indicates the IPL when IPL3 = 1.
REGISTER 3-2: CORCON: CPU CONTROL REGISTER
| U-0 | U-0 | U-0 | U-0 | U-0 | U-0 | U-0 | U-0 |
|---|---|---|---|---|---|---|---|
| — | — | — | — | — | — | — | — |
| bit 15 | bit 8 |
| U-0 | U-0 | U-0 | U-0 | R/C-0 | R/W-0 | U-0 | U-0 |
|---|---|---|---|---|---|---|---|
| — | — | — | — | IPL3⁽¹⁾ | PSV | — | — |
| bit 7 | bit 0 |
Legend:
-
R = Readable bit
-
W = Writable bit
-
U = Unimplemented bit, read as ‘0’
-
C = Clearable bit
-
‘1’ = Bit is set
-
‘0’ = Bit is cleared
-
-n = Value at POR
-
x = Bit is unknown
-
bit 15-4 Unimplemented: Read as ‘0’
-
bit 3 IPL3: CPU Interrupt Priority Level Status bit⁽¹⁾
- 1 = CPU Interrupt Priority Level is greater than 7
- 0 = CPU Interrupt Priority Level is 7 or less
-
bit 2 PSV: Program Space Visibility in Data Space Enable bit
- 1 = Program space is visible in data space
- 0 = Program space is not visible in data space
-
bit 1-0 Unimplemented: Read as ‘0’
Note 1: User interrupts are disabled when IPL3 = 1.
3.3 Arithmetic Logic Unit (ALU)
The PIC24F ALU is 16 bits wide, and is capable of addition, subtraction, bit shifts and logic operations. Unless otherwise mentioned, arithmetic operations are 2’s complement in nature. Depending on the operation, the ALU may affect the values of the Carry (C), Zero (Z), Negative (N), Overflow (OV) and Digit Carry (DC) Status bits in the SR register. The C and DC Status bits operate as Borrow and Digit Borrow bits, respectively, for subtraction operations.
The ALU can perform 8-bit or 16-bit operations, depending on the mode of the instruction that is used. Data for the ALU operation can come from the W register array, or data memory, depending on the addressing mode of the instruction. Likewise, output data from the ALU can be written to the W register array or a data memory location.
The PIC24F CPU incorporates hardware support for both multiplication and division. This includes a dedicated hardware multiplier and support hardware for 16-bit divisor division.
3.3.1 MULTIPLIER
The ALU contains a high-speed, 17-bit x 17-bit multiplier. It supports unsigned, signed or mixed sign operation in several multiplication modes:
- 16-bit x 16-bit signed
- 16-bit x 16-bit unsigned
- 16-bit signed x 5-bit (literal) unsigned
- 16-bit unsigned x 16-bit unsigned
- 16-bit unsigned x 5-bit (literal) unsigned
- 16-bit unsigned x 16-bit signed
- 8-bit unsigned x 8-bit unsigned
3.3.2 DIVIDER
The divide block supports 32-bit/16-bit and 16-bit/16-bit signed and unsigned integer divide operations with the following data sizes:
- 32-bit signed/16-bit signed divide
- 32-bit unsigned/16-bit unsigned divide
- 16-bit signed/16-bit signed divide
- 16-bit unsigned/16-bit unsigned divide
The quotient for all divide instructions ends up in W0 and the remainder in W1. Sixteen-bit signed and unsigned DIV instructions can specify any W register for both the 16-bit divisor (Wn), and any W register (aligned) pair (W(m + 1):Wm) for the 32-bit dividend. The divide algorithm takes one cycle per bit of divisor, so both 32-bit/16-bit and 16-bit/16-bit instructions take the same number of cycles to execute.
3.3.3 MULTI-BIT SHIFT SUPPORT
The PIC24F ALU supports both single bit and single-cycle, multi-bit arithmetic and logic shifts. Multi-bit shifts are implemented using a shifter block, capable of performing up to a 15-bit arithmetic right shift, or up to a 15-bit left shift, in a single cycle. All multi-bit shift instructions only support Register Direct Addressing for both the operand source and result destination.
A full summary of instructions that use the shift operation is provided below in Table 3-2.
TABLE 3-2: INSTRUCTIONS THAT USE THE SINGLE AND MULTI-BIT SHIFT OPERATION
| Instruction | Description |
|---|---|
| ASR | Arithmetic shift right source register by one or more bits. |
| SL | Shift left source register by one or more bits. |
| LSR | Logical shift right source register by one or more bits. |
4.0 MEMORY ORGANIZATION
As Harvard architecture devices, PIC24F microcontrollers feature separate program and data memory spaces and buses. This architecture also allows the direct access of program memory from the data space during code execution.
4.1 Program Address Space
The program address memory space of the PIC24FJ64GA004 family devices is 4M instructions. The space is addressable by a 24-bit value derived from either the 23-bit Program Counter (PC) during program execution, or from table operation or data space remapping, as described in Section 4.3 "Interfacing Program and Data Memory Spaces".
User access to the program memory space is restricted to the lower half of the address range (000000h to 7FFFFFh). The exception is the use of TBLRD/TBLWT operations which use TBLPAG<7> to permit access to the Configuration bits and Device ID sections of the configuration memory space.
Memory maps for the PIC24FJ64GA004 family of devices are shown in Figure 4-1.
FIGURE 4-1: PROGRAM SPACE MEMORY MAP FOR PIC24FJ64GA004 FAMILY DEVICES
Note: Memory areas are not shown to scale.
4.1.1 PROGRAM MEMORY ORGANIZATION
The program memory space is organized in word-addressable blocks. Although it is treated as 24 bits wide, it is more appropriate to think of each address of the program memory as a lower and upper word, with the upper byte of the upper word being unimplemented. The lower word always has an even address, while the upper word has an odd address (Figure 4-2).
Program memory addresses are always word-aligned on the lower word, and addresses are incremented or decremented by two during code execution. This arrangement also provides compatibility with data memory space addressing and makes it possible to access data in the program memory space.
4.1.2 HARD MEMORY VECTORS
All PIC24F devices reserve the addresses between 00000h and 000200h for hard-coded program execution vectors. A hardware Reset vector is provided to redirect code execution from the default value of the PC on device Reset to the actual start of code. A GOTO instruction is programmed by the user at 000000h with the actual address for the start of code at 000002h.
PIC24F devices also have two Interrupt Vector Tables (IVT), located from 000004h to 0000FFh and 000100h to 0001FFh. These vector tables allow each of the many device interrupt sources to be handled by separate ISRs. A more detailed discussion of the Interrupt Vector Tables is provided in Section 7.1 “Interrupt Vector Table”.
4.1.3 FLASH CONFIGURATION WORDS
In PIC24FJ64GA004 family devices, the top two words of on-chip program memory are reserved for configuration information. On device Reset, the configuration information is copied into the appropriate Configuration registers. The addresses of the Flash Configuration Word for devices in the PIC24FJ64GA004 family are shown in Table 4-1. Their location in the memory map is shown with the other memory vectors in Figure 4-1.
The Configuration Words in program memory are a compact format. The actual Configuration bits are mapped in several different registers in the configuration memory space. Their order in the Flash Configuration Words does not reflect a corresponding arrangement in the configuration space. Additional details on the device Configuration Words are provided in Section 24.1 “Configuration Bits”.
TABLE 4-1: FLASH CONFIGURATION WORDS FOR PIC24FJ64GA004 FAMILY DEVICES
| Device | Program Memory (K words) | Configuration Word Addresses |
|---|---|---|
| PIC24FJ16GA | 5.5 | 002BFCh: 002BFEh |
| PIC24FJ32GA | 11 | 0057FCh: 0057FEh |
| PIC24FJ48GA | 16 | 0083FCh: 0083FEh |
| PIC24FJ64GA | 22 | 00ABFCh: 00ABFEh |
FIGURE 4-2: PROGRAM MEMORY ORGANIZATION
4.2 Data Address Space
The PIC24F core has a separate, 16-bit wide data memory space, addressable as a single linear range. The data space is accessed using two Address Generation Units (AGUs), one each for read and write operations. The data space memory map is shown in Figure 4-3.
All Effective Addresses (EAs) in the data memory space are 16 bits wide and point to bytes within the data space. This gives a data space address range of 64 Kbytes or 32K words. The lower half of the data memory space (that is, when EA<15> = 0) is used for implemented memory addresses, while the upper half (EA<15> = 1) is reserved for the Program Space Visibility (PSV) area (see Section 4.3.3 “Reading Data From Program Memory Using Program Space Visibility”).
PIC24FJ64GA004 family devices implement a total of 8 Kbytes of data memory. Should an EA point to a location outside of this area, an all zero word or byte will be returned.
4.2.1 DATA SPACE WIDTH
The data memory space is organized in byte-addressable, 16-bit wide blocks. Data is aligned in data memory and registers as 16-bit words, but all data space EAs resolve to bytes. The Least Significant Bytes (LSBs) of each word have even addresses, while the Most Significant Bytes (MSBs) have odd addresses.
FIGURE 4-3: DATA SPACE MEMORY MAP FOR PIC24FJ64GA004 FAMILY DEVICES(1)

Note 1: Data memory areas are not shown to scale. 2: Upper memory limit for PIC24FJ16GAXXX devices is 17FFh.
4.2.2 DATA MEMORY ORGANIZATION AND ALIGNMENT
To maintain backward compatibility with PIC® devices and improve data space memory usage efficiency, the PIC24F instruction set supports both word and byte operations. As a consequence of byte accessibility, all Effective Address (EA) calculations are internally scaled to step through word-aligned memory. For example, the core recognizes that Post-Modified Register Indirect Addressing mode [Ws++] will result in a value of Ws + 1 for byte operations and Ws + 2 for word operations.
Data byte reads will read the complete word which contains the byte, using the LSb of any EA to determine which byte to select. The selected byte is placed onto the LSB of the data path. That is, data memory and registers are organized as two parallel, byte-wide entities with shared (word) address decode but separate write lines. Data byte writes only write to the corresponding side of the array or register which matches the byte address.
All word accesses must be aligned to an even address. Misaligned word data fetches are not supported, so care must be taken when mixing byte and word operations, or translating from 8-bit MCU code. If a misaligned read or write is attempted, an address error trap will be generated. If the error occurred on a read, the instruction underway is completed; if it occurred on a write, the instruction will be executed but the write will not occur. In either case, a trap is then executed, allowing the system and/or user to examine the machine state prior to execution of the address Fault.
All byte loads into any W register are loaded into the Least Significant Byte. The Most Significant Byte is not modified.
A Sign-Extend (SE) instruction is provided to allow users to translate 8-bit signed data to 16-bit signed values. Alternatively, for 16-bit unsigned data, users can clear the MSB of any W register by executing a Zero-Extend (ZE) instruction on the appropriate address.
Although most instructions are capable of operating on word or byte data sizes, it should be noted that some instructions operate only on words.
4.2.3 NEAR DATA SPACE
The 8-Kbyte area between 0000h and 1FFFh is referred to as the Near Data Space. Locations in this space are directly addressable via a 13-bit absolute address field within all memory direct instructions. The remainder of the data space is addressable indirectly. Additionally, the whole data space is addressable using MOV instructions, which support Memory Direct Addressing with a 16-bit address field.
4.2.4 SFR SPACE
The first 2 Kbytes of the Near Data Space, from 0000h to 07FFh, are primarily occupied with Special Function Registers (SFRs). These are used by the PIC24F core and peripheral modules for controlling the operation of the device.
SFRs are distributed among the modules that they control and are generally grouped together by module. Much of the SFR space contains unused addresses; these are read as ‘0’. A diagram of the SFR space, showing where SFRs are actually implemented, is shown in Table 4-2. Each implemented area indicates a 32-byte region where at least one address is implemented as an SFR. A complete listing of implemented SFRs, including their addresses, is shown in Tables 4-3 through 4-24.
TABLE 4-2: IMPLEMENTED REGIONS OF SFR DATA SPACE
| SFR Space Address | xx00 | xx20 | xx40 | xx60 | xx80 | xxA0 | xxC0 | xxE0 |
|---|---|---|---|---|---|---|---|---|
| 000h | Core | ICN | Interrupts | — | ||||
| 100h | Timers | Capture | — | Compare | — | — | — | |
| 200h | I²C™ | UART | SPI | — | — | — | I/O | |
| 300h | A/D | — | — | — | — | — | — | |
| 400h | — | — | — | — | — | — | — | |
| 500h | — | — | — | — | — | — | — | |
| 600h | PMP | RTC/Comp | CRC | — | PPS | |||
| 700h | — | — | System | NVM/PMD | — | — | — |
Legend: — = No implemented SFRs in this block
TABLE 4-3: CPU CORE REGISTERS MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WREG0 | 0000 | 0000 | ||||||||||||||||
| WREG1 | 0002 | 0000 | ||||||||||||||||
| WREG2 | 0004 | 0000 | ||||||||||||||||
| WREG3 | 0006 | 0000 | ||||||||||||||||
| WREG4 | 0008 | 0000 | ||||||||||||||||
| WREG5 | 000A | 0000 | ||||||||||||||||
| WREG6 | 000C | 0000 | ||||||||||||||||
| WREG7 | 000E | 0000 | ||||||||||||||||
| WREG8 | 0010 | 0000 | ||||||||||||||||
| WREG9 | 0012 | 0000 | ||||||||||||||||
| WREG10 | 0014 | 0000 | ||||||||||||||||
| WREG11 | 0016 | 0000 | ||||||||||||||||
| WREG12 | 0018 | 0000 | ||||||||||||||||
| WREG13 | 001A | 0000 | ||||||||||||||||
| WREG14 | 001C | 0000 | ||||||||||||||||
| WREG15 | 001E | 0800 | ||||||||||||||||
| SPLIM | 0020 | xxxx | ||||||||||||||||
| PCL | 002E | 0000 | ||||||||||||||||
| PCH | 0030 | — | — | — | — | — | — | — | — | 0000 | ||||||||
| TBLPAG | 0032 | — | — | — | — | — | — | — | — | 0000 | ||||||||
| PSVPAG | 0034 | — | — | — | — | — | — | — | — | 0000 | ||||||||
| RCOUNT | 0036 | xxxx | ||||||||||||||||
| SR | 0042 | — | — | — | — | — | — | — | DC | IPL2 | IPL1 | IPL0 | RA | N | OV | Z | C | 0000 |
| CORCON | 0044 | — | — | — | — | — | — | — | — | — | — | — | — | IPL3 | PSV | — | — | 0000 |
| DISICNT | 0052 | — | — | xxxx |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-4: ICN REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| CNEN1 | 0060 | CN15IE | CN14IE | CN13IE | CN12IE | CN11IE | CN10IE(1) | CN9IE(1) | CN8IE(1) | CN7IE | CN6IE | CN5IE | CN4IE | CN3IE | CN2IE | CN1IE | CN0IE | 0000 |
| CNEN2 | 0062 | — | CN30IE | CN29IE | CN28IE(1) | CN27IE | CN26IE(1) | CN25IE(1) | CN24IE | CN23IE | CN22IE | CN21IE | CN20IE(1) | CN19IE(1) | CN18IE(1) | CN17IE(1) | CN16IE | 0000 |
| CNPU1 | 0068 | CN15PUE | CN14PUE | CN13PUE | CN12PUE | CN11PUE | CN10PUE(1) | CN9PUE(1) | CN8PUE(1) | CN7PUE | CN6PUE | CN5PUE | CN4PUE | CN3PUE | CN2PUE | CN1PUE | CN0PUE | 0000 |
| CNPU2 | 006A | — | CN30PUE | CN29PUE | CN28PUE(1) | CN27PUE | CN26PUE(1) | CN25PUE(1) | CN24PUE | CN23PUE | CN22PUE | CN21PUE | CN20PUE(1) | CN19PUE(1) | CN18PUE(1) | CN17PUE(1) | CN16PUE | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: These bits are not available on 28-pin devices; read as ‘0’.
PIC24FJ64GA004 FAMILY
TABLE 4-5: INTERRUPT CONTROLLER REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| INTCON1 | 0080 | NSTDIS | — | — | — | — | — | — | — | — | — | — | MATHERR | ADDRERR | STKERR | OSCFAIL | — | 0000 |
| INTCON2 | 0082 | ALTIVT | DISI | — | — | — | — | — | — | — | — | — | — | — | INT2EP | INT1EP | INT0EP | 0000 |
| IFS0 | 0084 | — | — | AD1IF | U1TXIF | U1RXIF | SPI1IF | SPF1IF | T3IF | T2IF | OC2IF | IC2IF | — | T1IF | OC1IF | IC1IF | INT0IF | 0000 |
| IFS1 | 0086 | U2TXIF | U2RXIF | INT2IF | T5IF | T4IF | OC4IF | OC3IF | — | — | — | — | INT1IF | CNIF | CMIF | MI2C1IF | SI2C1IF | 0000 |
| IFS2 | 0088 | — | — | PMPIF | — | — | — | OC5IF | — | IC5IF | IC4IF | IC3IF | — | — | — | SPI2IF | SPF2IF | 0000 |
| IFS3 | 008A | — | RTCIF | — | — | — | — | — | — | — | — | — | — | — | MI2C2IF | SI2C2IF | — | 0000 |
| IFS4 | 008C | — | — | — | — | — | — | — | LVDIF | — | — | — | — | CRCIF | U2ERIF | U1ERIF | — | 0000 |
| IEC0 | 0094 | — | — | AD1IE | U1TXIE | U1RXIE | SPI1IE | SPF1IE | T3IE | T2IE | OC2IE | IC2IE | — | T1IE | OC1IE | IC1IE | INT0IE | 0000 |
| IEC1 | 0096 | U2TXIE | U2RXIE | INT2IE | T5IE | T4IE | OC4IE | OC3IE | — | — | — | — | INT1IE | CNIE | CMIE | MI2C1IE | SI2C1IE | 0000 |
| IEC2 | 0098 | — | — | PMPIE | — | — | — | OC5IE | — | IC5IE | IC4IE | IC3IE | — | — | — | SPI2IE | SPF2IE | 0000 |
| IEC3 | 009A | — | RTCIE | — | — | — | — | — | — | — | — | — | — | — | MI2C2IE | SI2C2IE | — | 0000 |
| IEC4 | 009C | — | — | — | — | — | — | — | LVDIE | — | — | — | — | CRCIE | U2ERIE | U1ERIE | — | 0000 |
| IPC0 | 00A4 | — | T1IP2 | T1IP1 | T1IP0 | — | OC1IP2 | OC1IP1 | OC1IP0 | — | IC1IP2 | IC1IP1 | IC1IP0 | — | INT0IP2 | INT0IP1 | INT0IP0 | 4444 |
| IPC1 | 00A6 | — | T2IP2 | T2IP1 | T2IP0 | — | OC2IP2 | OC2IP1 | OC2IP0 | — | IC2IP2 | IC2IP1 | IC2IP0 | — | — | — | — | 4444 |
| IPC2 | 00A8 | — | U1RXIP2 | U1RXIP1 | U1RXIP0 | — | SPI1IP2 | SPI1IP1 | SPI1IP0 | — | SPF1IP2 | SPF1IP1 | SPF1IP0 | — | T3IP2 | T3IP1 | T3IP0 | 4444 |
| IPC3 | 00AA | — | — | — | — | — | — | — | — | — | AD1IP2 | AD1IP1 | AD1IP0 | — | U1TXIP2 | U1TXIP1 | U1TXIP0 | 4444 |
| IPC4 | 00AC | — | CNIP2 | CNIP1 | CNIP0 | — | CMIP2 | CMIP1 | CMIP0 | — | MI2C1P2 | MI2C1P1 | MI2C1P0 | — | SI2C1P2 | SI2C1P1 | SI2C1P0 | 4444 |
| IPC5 | 00AE | — | — | — | — | — | — | — | — | — | — | — | — | — | INT1IP2 | INT1IP1 | INT1IP0 | 4444 |
| IPC6 | 00B0 | — | T4IP2 | T4IP1 | T4IP0 | — | OC4IP2 | OC4IP1 | OC4IP0 | — | OC3IP2 | OC3IP1 | OC3IP0 | — | — | — | — | 4444 |
| IPC7 | 00B2 | — | U2TXIP2 | U2TXIP1 | U2TXIP0 | — | U2RXIP2 | U2RXIP1 | U2RXIP0 | — | INT2IP2 | INT2IP1 | INT2IP0 | — | T5IP2 | T5IP1 | T5IP0 | 4444 |
| IPC8 | 00B4 | — | — | — | — | — | — | — | — | — | SPI2IP2 | SPI2IP1 | SPI2IP0 | — | SPF2IP2 | SPF2IP1 | SPF2IP0 | 4444 |
| IPC9 | 00B6 | — | IC5IP2 | IC5IP1 | IC5IP0 | — | IC4IP2 | IC4IP1 | IC4IP0 | — | IC3IP2 | IC3IP1 | IC3IP0 | — | — | — | — | 4444 |
| IPC10 | 00B8 | — | — | — | — | — | — | — | — | — | OC5IP2 | OC5IP1 | OC5IP0 | — | — | — | — | 4444 |
| IPC11 | 00BA | — | — | — | — | — | — | — | — | — | PMPIP2 | PMPIP1 | PMPIP0 | — | — | — | — | 4444 |
| IPC12 | 00BC | — | — | — | — | — | MI2C2P2 | MI2C2P1 | MI2C2P0 | — | SI2C2P2 | SI2C2P1 | SI2C2P0 | — | — | — | — | 4444 |
| IPC15 | 00C2 | — | — | — | — | — | RTCIP2 | RTCIP1 | RTCIP0 | — | — | — | — | — | — | — | — | 4444 |
| IPC16 | 00C4 | — | CRCIP2 | CRCIP1 | CRCIP0 | — | U2ERIP2 | U2ERIP1 | U2ERIP0 | — | U1ERIP2 | U1ERIP1 | U1ERIP0 | — | — | — | — | 4444 |
| IPC18 | 00C8 | — | — | — | — | — | — | — | — | — | — | — | — | — | LVDIP2 | LVDIP1 | LVDIP0 | 4444 |
| INTTREG | 00E0 | CPUIRQ | — | VHOLD | — | ILR3 | ILR2 | ILR1 | ILR0 | — | VECNUM6 | VECNUM5 | VECNUM4 | VECNUM3 | VECNUM2 | VECNUM1 | VECNUM0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-6: TIMER REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TMR1 | 0100 | 0000 | ||||||||||||||||
| PR1 | 0102 | FFFF | ||||||||||||||||
| T1CON | 0104 | TON | — | TSIDL | — | — | — | — | — | — | TGATE | TCKPS1 | TCKPS0 | — | TSYNC | TCS | — | 0000 |
| TMR2 | 0106 | 0000 | ||||||||||||||||
| TMR3HLD | 0108 | 0000 | ||||||||||||||||
| TMR3 | 010A | 0000 | ||||||||||||||||
| PR2 | 010C | FFFF | ||||||||||||||||
| PR3 | 010E | FFFF | ||||||||||||||||
| T2CON | 0110 | TON | — | TSIDL | — | — | — | — | — | — | TGATE | TCKPS1 | TCKPS0 | T32 | — | TCS | — | 0000 |
| T3CON | 0112 | TON | — | TSIDL | — | — | — | — | — | — | TGATE | TCKPS1 | TCKPS0 | — | — | TCS | — | 0000 |
| TMR4 | 0114 | 0000 | ||||||||||||||||
| TMR5HLD | 0116 | 0000 | ||||||||||||||||
| TMR5 | 0118 | 0000 | ||||||||||||||||
| PR4 | 011A | FFFF | ||||||||||||||||
| PR5 | 011C | FFFF | ||||||||||||||||
| T4CON | 011E | TON | — | TSIDL | — | — | — | — | — | — | TGATE | TCKPS1 | TCKPS0 | T32 | — | TCS | — | 0000 |
| T5CON | 0120 | TON | — | TSIDL | — | — | — | — | — | — | TGATE | TCKPS1 | TCKPS0 | — | — | TCS | — | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-7: INPUT CAPTURE REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| IC1BUF | 0140 | FFFF | ||||||||||||||||
| IC1CON | 0142 | — | — | ICSIDL | — | — | — | — | — | ICTMR | ICI1 | ICI0 | ICOV | ICBNE | ICM2 | ICM1 | ICM0 | 0000 |
| IC2BUF | 0144 | FFFF | ||||||||||||||||
| IC2CON | 0146 | — | — | ICSIDL | — | — | — | — | — | ICTMR | ICI1 | ICI0 | ICOV | ICBNE | ICM2 | ICM1 | ICM0 | 0000 |
| IC3BUF | 0148 | FFFF | ||||||||||||||||
| IC3CON | 014A | — | — | ICSIDL | — | — | — | — | — | ICTMR | ICI1 | ICI0 | ICOV | ICBNE | ICM2 | ICM1 | ICM0 | 0000 |
| IC4BUF | 014C | FFFF | ||||||||||||||||
| IC4CON | 014E | — | — | ICSIDL | — | — | — | — | — | ICTMR | ICI1 | ICI0 | ICOV | ICBNE | ICM2 | ICM1 | ICM0 | 0000 |
| IC5BUF | 0150 | FFFF | ||||||||||||||||
| IC5CON | 0152 | — | — | ICSIDL | — | — | — | — | — | ICTMR | ICI1 | ICI0 | ICOV | ICBNE | ICM2 | ICM1 | ICM0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
PIC24FJ64GA004 FAMILY
TABLE 4-8: OUTPUT COMPARE REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| OC1RS | 0180 | FFFF | ||||||||||||||||
| OC1R | 0182 | FFFF | ||||||||||||||||
| OC1CON | 0184 | — | — | OCSIDL | — | — | — | — | — | — | — | — | OCFLT | OCTSEL | OCM2 | OCM1 | OCM0 | 0000 |
| OC2RS | 0186 | FFFF | ||||||||||||||||
| OC2R | 0188 | FFFF | ||||||||||||||||
| OC2CON | 018A | — | — | OCSIDL | — | — | — | — | — | — | — | — | OCFLT | OCTSEL | OCM2 | OCM1 | OCM0 | 0000 |
| OC3RS | 018C | FFFF | ||||||||||||||||
| OC3R | 018E | FFFF | ||||||||||||||||
| OC3CON | 0190 | — | — | OCSIDL | — | — | — | — | — | — | — | — | OCFLT | OCTSEL | OCM2 | OCM1 | OCM0 | 0000 |
| OC4RS | 0192 | FFFF | ||||||||||||||||
| OC4R | 0194 | FFFF | ||||||||||||||||
| OC4CON | 0196 | — | — | OCSIDL | — | — | — | — | — | — | — | — | OCFLT | OCTSEL | OCM2 | OCM1 | OCM0 | 0000 |
| OC5RS | 0198 | FFFF | ||||||||||||||||
| OC5R | 019A | FFFF | ||||||||||||||||
| OC5CON | 019C | — | — | OCSIDL | — | — | — | — | — | — | — | — | OCFLT | OCTSEL | OCM2 | OCM1 | OCM0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-9: I²C™ REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| I2C1RCV | 0200 | — | — | — | — | — | — | — | — | 0000 | ||||||||
| I2C1TRN | 0202 | — | — | — | — | — | — | — | — | 00FF | ||||||||
| I2C1BRG | 0204 | — | — | — | — | — | — | — | — | 0000 | ||||||||
| I2C1CON | 0206 | I2CEN | — | I2CSIDL | SCLREL | IPMIEN | A10M | DISS LW | SMEN | GCEN | STREN | ACKDT | ACKEN | RCEN | PEN | RSEN | SEN | 1000 |
| I2C1STAT | 0208 | ACKSTAT | TRSTAT | — | — | — | BCL | GCSTAT | ADD10 | IWCOL | I2COV | D/Ā | P | S | R/W̄ | RBF | TBF | 0000 |
| I2C1ADD | 020A | — | — | — | — | — | — | 0000 | ||||||||||
| I2C1MSK | 020C | — | — | — | — | — | — | AMSK9 | AMSK8 | AMSK7 | AMSK6 | AMSK5 | AMSK4 | AMSK3 | AMSK2 | AMSK1 | AMSK0 | 0000 |
| I2C2RCV | 0210 | — | — | — | — | — | — | — | — | 0000 | ||||||||
| I2C2TRN | 0212 | — | — | — | — | — | — | — | — | 00FF | ||||||||
| I2C2BRG | 0214 | — | — | — | — | — | — | — | — | 0000 | ||||||||
| I2C2CON | 0216 | I2CEN | — | I2CSIDL | SCLREL | IPMIEN | A10M | DISS LW | SMEN | GCEN | STREN | ACKDT | ACKEN | RCEN | PEN | RSEN | SEN | 1000 |
| I2C2STAT | 0218 | ACKSTAT | TRSTAT | — | — | — | BCL | GCSTAT | ADD10 | IWCOL | I2COV | D/Ā | P | S | R/W̄ | RBF | TBF | 0000 |
| I2C2ADD | 021A | — | — | — | — | — | — | 0000 | ||||||||||
| I2C2MSK | 021C | — | — | — | — | — | — | AMSK9 | AMSK8 | AMSK7 | AMSK6 | AMSK5 | AMSK4 | AMSK3 | AMSK2 | AMSK1 | AMSK0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-10: UART REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| U1MODE | 0220 | UARTEN | — | USIDL | IREN | RTSMD | — | UEN1 | UEN0 | WAKE | LPBACK | ABAUD | RXINV | BRGH | PDSEL1 | PDSEL0 | STSEL | 0000 |
| U1STA | 0222 | UTXISEL1 | UTXINV | UTXISEL0 | — | UTXBRK | UTXEN | UTXBF | TRMT | URXISEL1 | URXISEL0 | ADDEN | RIDLE | PERR | FERR | OERR | URXDA | 0110 |
| U1TXREG | 0224 | — | — | — | — | — | — | — | UTX8 | UTX7 | UTX6 | UTX5 | UTX4 | UTX3 | UTX2 | UTX1 | UTX0 | 0000 |
| U1RXREG | 0226 | — | — | — | — | — | — | — | URX8 | URX7 | URX6 | URX5 | URX4 | URX3 | URX2 | URX1 | URX0 | 0000 |
| U1BRG | 0228 | 0000 | ||||||||||||||||
| U2MODE | 0230 | UARTEN | — | USIDL | IREN | RTSMD | — | UEN1 | UEN0 | WAKE | LPBACK | ABAUD | RXINV | BRGH | PDSEL1 | PDSEL0 | STSEL | 0000 |
| U2STA | 0232 | UTXISEL1 | UTXINV | UTXISEL0 | — | UTXBRK | UTXEN | UTXBF | TRMT | URXISEL1 | URXISEL0 | ADDEN | RIDLE | PERR | FERR | OERR | URXDA | 0110 |
| U2TXREG | 0234 | — | — | — | — | — | — | — | UTX8 | UTX7 | UTX6 | UTX5 | UTX4 | UTX3 | UTX2 | UTX1 | UTX0 | 0000 |
| U2RXREG | 0236 | — | — | — | — | — | — | — | URX8 | URX7 | URX6 | URX5 | URX4 | URX3 | URX2 | URX1 | URX0 | 0000 |
| U2BRG | 0238 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-11: SPI REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| SPI1STAT | 0240 | SPIEN | — | SPISIDL | — | — | SPIBEC2 | SPIBEC1 | SPIBEC0 | SRMPT | SPIROV | SRXMPT | SISEL2 | SISEL1 | SISEL0 | SPITBF | SPIRBF | 0000 |
| SPI1CON1 | 0242 | — | — | — | DISSCK | DISSDO | MODE16 | SMP | CKE | SSEN | CKP | MSTEN | SPRE2 | SPRE1 | SPRE0 | PPRE1 | PPRE0 | 0000 |
| SPI1CON2 | 0244 | FRMEN | SPIFSD | SPIFPOL | — | — | — | — | — | — | — | — | — | — | — | SPIFE | SPIBEN | 0000 |
| SPI1BUF | 0248 | 0000 | ||||||||||||||||
| SPI2STAT | 0260 | SPIEN | — | SPISIDL | — | — | SPIBEC2 | SPIBEC1 | SPIBEC0 | SRMPT | SPIROV | SRXMPT | SISEL2 | SISEL1 | SISEL0 | SPITBF | SPIRBF | 0000 |
| SPI2CON1 | 0262 | — | — | — | DISSCK | DISSDO | MODE16 | SMP | CKE | SSEN | CKP | MSTEN | SPRE2 | SPRE1 | SPRE0 | PPRE1 | PPRE0 | 0000 |
| SPI2CON2 | 0264 | FRMEN | SPIFSD | SPIFPOL | — | — | — | — | — | — | — | — | — | — | — | SPIFE | SPIBEN | 0000 |
| SPI2BUF | 0268 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-12: PORTA REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TRISA | 02C0 | — | — | — | — | — | TRISA10⁽¹⁾ | TRISA9⁽¹⁾ | TRISA8⁽¹⁾ | TRISA7⁽¹⁾ | — | — | TRISA4 | TRISA3⁽²⁾ | TRISA2⁽³⁾ | TRISA1 | TRISA0 | 079F |
| PORTA | 02C2 | — | — | — | — | — | RA10⁽¹⁾ | RA9⁽¹⁾ | RA8⁽¹⁾ | RA7⁽¹⁾ | — | — | RA4 | RA3⁽²⁾ | RA2⁽³⁾ | RA1 | RA0 | 0000 |
| LATA | 02C4 | — | — | — | — | — | LATA10⁽¹⁾ | LATA9⁽¹⁾ | LATA8⁽¹⁾ | LATA7⁽¹⁾ | — | — | LATA4 | LATA3⁽²⁾ | LATA2⁽³⁾ | LATA1 | LATA0 | 0000 |
| ODCA | 02C6 | — | — | — | — | — | ODA10⁽¹⁾ | ODA9⁽¹⁾ | ODA8⁽¹⁾ | ODA7⁽¹⁾ | — | — | ODA4 | ODA3⁽²⁾ | ODA2⁽³⁾ | ODA1 | ODA0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: These bits are not available on 28-pin devices; read as ‘0’.
2: These bits are only available when the primary oscillator is disabled (POSCMD<1:0> = 00); otherwise, read as ‘0’.
3: These bits are only available when the primary oscillator is disabled or EC mode is selected (POSCMD<1:0> = 00 or 11) and CLKO is disabled (OSCIOfNC = 0); otherwise, read as ‘0’.
TABLE 4-13: PORTB REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TRISB | 02C8 | TRISB15 | TRISB14 | TRISB13 | TRISB12 | TRISB11 | TRISB10 | TRISB9 | TRISB8 | TRISB7 | TRISB6 | TRISB5 | TRISB4 | TRISB3 | TRISB2 | TRISB1 | TRISB0 | FFFF |
| PORTB | 02CA | RB15 | RB14 | RB13 | RB12 | RB11 | RB10 | RB9 | RB8 | RB7 | RB6 | RB5 | RB4 | RB3 | RB2 | RB1 | RB0 | 0000 |
| LATB | 02CC | LATB15 | LATB14 | LATB13 | LATB12 | LATB11 | LATB10 | LATB9 | LATB8 | LATB7 | LATB6 | LATB5 | LATB4 | LATB3 | LATB2 | LATB1 | LATB0 | 0000 |
| ODCB | 02CE | ODB15 | ODB14 | ODB13 | ODB12 | ODB11 | ODB10 | ODB9 | ODB8 | ODB7 | ODB6 | ODB5 | ODB4 | ODB3 | ODB2 | ODB1 | ODB0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-14: PORTC REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TRISC⁽¹⁾ | 02D0 | — | — | — | — | — | — | TRISC9 | TRISC8 | TRISC7 | TRISC6 | TRISC5 | TRISC4 | TRISC3 | TRISC2 | TRISC1 | TRISC0 | 03FF |
| PORTC⁽¹⁾ | 02D2 | — | — | — | — | — | — | RC9 | RC8 | RC7 | RC6 | RC5 | RC4 | RC3 | RC2 | RC1 | RC0 | 0000 |
| LATC⁽¹⁾ | 02D4 | — | — | — | — | — | — | LATC9 | LATC8 | LATC7 | LATC6 | LATC5 | LATC4 | LATC3 | LATC2 | LATC1 | LATC0 | 0000 |
| ODCC⁽¹⁾ | 02D6 | — | — | — | — | — | — | ODC9 | OSC8 | ODC7 | ODC6 | ODC5 | ODC4 | ODC3 | ODC2 | ODC1 | ODC0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal. Bits are not available on 28-pin devices; read as ‘0’.
TABLE 4-15: PAD CONFIGURATION REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PADCFG1 | 02FC | — | — | — | — | — | — | — | — | — | — | — | — | — | — | RTSECSSEL | PMPTTL | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-16: A/D REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ADC1BUF0 | 0300 | xxxx | ||||||||||||||||
| ADC1BUF1 | 0302 | xxxx | ||||||||||||||||
| ADC1BUF2 | 0304 | xxxx | ||||||||||||||||
| ADC1BUF3 | 0306 | xxxx | ||||||||||||||||
| ADC1BUF4 | 0308 | xxxx | ||||||||||||||||
| ADC1BUF5 | 030A | xxxx | ||||||||||||||||
| ADC1BUF6 | 030C | xxxx | ||||||||||||||||
| ADC1BUF7 | 030E | xxxx | ||||||||||||||||
| ADC1BUF8 | 0310 | xxxx | ||||||||||||||||
| ADC1BUF9 | 0312 | xxxx | ||||||||||||||||
| ADC1BUFA | 0314 | xxxx | ||||||||||||||||
| ADC1BUFB | 0316 | xxxx | ||||||||||||||||
| ADC1BUFC | 0318 | xxxx | ||||||||||||||||
| ADC1BUFD | 031A | xxxx | ||||||||||||||||
| ADC1BUFE | 031C | xxxx | ||||||||||||||||
| ADC1BUFF | 031E | xxxx | ||||||||||||||||
| AD1CON1 | 0320 | ADON | — | ADSIDL | — | — | — | FORM1 | FORM0 | SSRC2 | SSRC1 | SSRC0 | — | — | ASAM | SAMP | DONE | 0000 |
| AD1CON2 | 0322 | VCFG2 | VCFG1 | VCFG0 | — | — | CSCNA | — | — | BUFS | — | SMPI3 | SMPI2 | SMPI1 | SMPI0 | BUFM | ALTS | 0000 |
| AD1CON3 | 0324 | ADRC | — | — | SAMC4 | SAMC3 | SAMC2 | SAMC1 | SAMC0 | ADCS7 | ADCS6 | ADCS5 | ADCS4 | ADCS3 | ADCS2 | ADCS1 | ADCS0 | 0000 |
| AD1CHS | 0328 | CH0NB | — | — | — | CH0SB3 | CH0SB2 | CH0SB1 | CH0SB0 | CH0NA | — | — | — | CH0SA3 | CH0SA2 | CH0SA1 | CH0SA0 | 0000 |
| AD1PCFG | 032C | PCFG15 | — | — | PCFG12 | PCFG11 | PCFG10 | PCFG9 | PCFG8⁽¹⁾ | PCFG7⁽¹⁾ | PCFG6⁽¹⁾ | PCFG5 | PCFG4 | PCFG3 | PCFG2 | PCFG1 | PCFG0 | 0000 |
| AD1CSSL | 0330 | CSSL15 | — | — | CSSL12 | CSSL11 | CSSL10 | CSSL9 | CSSL8⁽¹⁾ | CSSL7⁽¹⁾ | CSSL6⁽¹⁾ | CSSL5 | CSSL4 | CSSL3 | CSSL2 | CSSL1 | CSSL0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: These bits are not available on 28-pin devices; read as ‘0’.
PIC24FJ64GA004 FAMILY
TABLE 4-17: PARALLEL MASTER/SLAVE PORT REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PMCON | 0600 | PMPEN | — | PSIDL | ADRMUX1 | ADRMUX0 | PTBEEN | PTWREN | PTRDEN | CSF1 | CSF0 | ALP | — | CS1P | BEP | WRSP | RDSP | 0000 |
| PMMODE | 0602 | BUSY | IRQM1 | IRQM0 | INCM1 | INCM0 | MODE16 | MODE1 | MODE0 | WAITB1 | WAITB0 | WAITM3 | WAITM2 | WAITM1 | WAITM0 | WAITE1 | WAITE0 | 0000 |
| PMADDR | 0604 | — | CS1 | — | — | — | ADDR10 | ADDR9 | ADDR8 | ADDR7 | ADDR6 | ADDR5 | ADDR4 | ADDR3 | ADDR2 | ADDR1 | ADDR0 | 0000 |
| PMDOUT1 | 0000 | |||||||||||||||||
| PMDOUT2 | 0606 | 0000 | ||||||||||||||||
| PMDIN1 | 0608 | 0000 | ||||||||||||||||
| PMDIN2 | 060A | 0000 | ||||||||||||||||
| PMAEN | 060C | — | PTEN14 | — | — | — | PTEN10 | PTEN9 | PTEN8 | PTEN7 | PTEN6 | PTEN5 | PTEN4 | PTEN3 | PTEN2 | PTEN1 | PTEN0 | 0000 |
| PMSTAT | 060E | IBF | IBOV | — | — | IB3F | IB2F | IB1F | IB0F | OBE | OBUF | — | — | OB3E | OB2E | OB1E | OB0E | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-18: REAL-TIME CLOCK AND CALENDAR REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ALRMVAL | 0620 | xxxx | ||||||||||||||||
| ALCFGRPT | 0622 | ALRMEN | CHIME | AMASK3 | AMASK2 | AMASK1 | AMASK0 | ALRMPTR1 | ALRMPTR0 | ARPT7 | ARPT6 | ARPT5 | ARPT4 | ARPT3 | ARPT2 | ARPT1 | ARPT0 | 0000 |
| RTCVAL | 0624 | xxxx | ||||||||||||||||
| RCFGCAL | 0626 | RTCEN | — | RTCWREN | RTCSYNC | HALFSEC | RTCOE | RTCPTR1 | RTCPTR0 | CAL7 | CAL6 | CAL5 | CAL4 | CAL3 | CAL2 | CAL1 | CAL0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-19: DUAL COMPARATOR REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| CMCON | 0630 | CMIDL | — | C2EVT | C1EVT | C2EN | C1EN | C2OUTEN | C1OUTEN | C2OUT | C1OUT | C2INV | C1INV | C2NEG | C2POS | C1NEG | C1POS | 0000 |
| CVRCON | 0632 | — | — | — | — | — | — | — | — | CVREN | CVROE | CVRR | CVRSS | CVR3 | CVR2 | CVR1 | CVR0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-20: CRC REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| CRCCON | 0640 | — | — | CSIDL | VWORD4 | VWORD3 | VWORD2 | VWORD1 | VWORD0 | CRCFUL | CRCMPT | — | CRCGO | PLEN3 | PLEN2 | PLEN1 | PLEN0 | 0040 |
| CRCXOR | 0642 | X15 | X14 | X13 | X12 | X11 | X10 | X9 | X8 | X7 | X6 | X5 | X4 | X3 | X2 | X1 | — | 0000 |
| CRCDAT | 0644 | 0000 | ||||||||||||||||
| CRCWDAT | 0646 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
TABLE 4-21: PERIPHERAL PIN SELECT REGISTER MAP (PPS)
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RPINR0 | 0680 | — | — | — | INT1R4 | INT1R3 | INT1R2 | INT1R1 | INT1R0 | — | — | — | — | — | — | — | — | 1F00 |
| RPINR1 | 0682 | — | — | — | — | — | — | — | — | — | — | — | INT2R4 | INT2R3 | INT2R2 | INT2R1 | INT2R0 | 001F |
| RPINR3 | 0686 | — | — | — | T3CKR4 | T3CKR3 | T3CKR2 | T3CKR1 | T3CKR0 | — | — | — | T2CKR4 | T2CKR3 | T2CKR2 | T2CKR1 | T2CKR0 | 1F1F |
| RPINR4 | 0688 | — | — | — | T5CKR4 | T5CKR3 | T5CKR2 | T5CKR1 | T5CKR0 | — | — | — | T4CKR4 | T4CKR3 | T4CKR2 | T4CKR1 | T4CKR0 | 1F1F |
| RPINR7 | 068E | — | — | — | IC2R4 | IC2R3 | IC2R2 | IC2R1 | IC2R0 | — | — | — | IC1R4 | IC1R3 | IC1R2 | IC1R1 | IC1R0 | 1F1F |
| RPINR8 | 0690 | — | — | — | IC4R4 | IC4R3 | IC4R2 | IC4R1 | IC4R0 | — | — | — | IC3R4 | IC3R3 | IC3R2 | IC3R1 | IC3R0 | 1F1F |
| RPINR9 | 0692 | — | — | — | — | — | — | — | — | — | — | — | IC5R4 | IC5R3 | IC5R2 | IC5R1 | IC5R0 | 001F |
| RPINR11 | 0696 | — | — | — | OCFBR4 | OCFBR3 | OCFBR2 | OCFBR1 | OCFBR0 | — | — | — | OCFAR4 | OCFAR3 | OCFAR2 | OCFAR1 | OCFAR0 | 1F1F |
| RPINR18 | 06A4 | — | — | — | U1CTSR4 | U1CTSR3 | U1CTSR2 | U1CTSR1 | U1CTSR0 | — | — | — | U1RXR4 | U1RXR3 | U1RXR2 | U1RXR1 | U1RXR0 | 1F1F |
| RPINR19 | 06A6 | — | — | — | U2CTSR4 | U2CTSR3 | U2CTSR2 | U2CTSR1 | U2CTSR0 | — | — | — | U2RXR4 | U2RXR3 | U2RXR2 | U2RXR1 | U2RXR0 | 1F1F |
| RPINR20 | 06A8 | — | — | — | SCK1R4 | SCK1R3 | SCK1R2 | SCK1R1 | SCK1R0 | — | — | — | SDI1R4 | SDI1R3 | SDI1R2 | SDI1R1 | SDI1R0 | 1F1F |
| RPINR21 | 06AA | — | — | — | — | — | — | — | — | — | — | — | SS1R4 | SS1R3 | SS1R2 | SS1R1 | SS1R0 | 001F |
| RPINR22 | 06AC | — | — | — | SCK2R4 | SCK2R3 | SCK2R2 | SCK2R1 | SCK2R0 | — | — | — | SDI2R4 | SDI2R3 | SDI2R2 | SDI2R1 | SDI2R0 | 1F1F |
| RPINR23 | 06AE | — | — | — | — | — | — | — | — | — | — | — | SS2R4 | SS2R3 | SS2R2 | SS2R1 | SS2R0 | 001F |
| RPOR0 | 06C0 | — | — | — | RP1R4 | RP1R3 | RP1R2 | RP1R1 | RP1R0 | — | — | — | RP0R4 | RP0R3 | RP0R2 | RP0R1 | RP0R0 | 0000 |
| RPOR1 | 06C2 | — | — | — | RP3R4 | RP3R3 | RP3R2 | RP3R1 | RP3R0 | — | — | — | RP2R4 | RP2R3 | RP2R2 | RP2R1 | RP2R0 | 0000 |
| RPOR2 | 06C4 | — | — | — | RP5R4 | RP5R3 | RP5R2 | RP5R1 | RP5R0 | — | — | — | RP4R4 | RP4R3 | RP4R2 | RP4R1 | RP4R0 | 0000 |
| RPOR3 | 06C6 | — | — | — | RP7R4 | RP7R3 | RP7R2 | RP7R1 | RP7R0 | — | — | — | RP6R4 | RP6R3 | RP6R2 | RP6R1 | RP6R0 | 0000 |
| RPOR4 | 06C8 | — | — | — | RP9R4 | RP9R3 | RP9R2 | RP9R1 | RP9R0 | — | — | — | RP8R4 | RP8R3 | RP8R2 | RP8R1 | RP8R0 | 0000 |
| RPOR5 | 06CA | — | — | — | RP11R4 | RP11R3 | RP11R2 | RP11R1 | RP11R0 | — | — | — | RP10R4 | RP10R3 | RP10R2 | RP10R1 | RP10R0 | 0000 |
| RPOR6 | 06CC | — | — | — | RP13R4 | RP13R3 | RP13R2 | RP13R1 | RP13R0 | — | — | — | RP12R4 | RP12R3 | RP12R2 | RP12R1 | RP12R0 | 0000 |
| RPOR7 | 06CE | — | — | — | RP15R4 | RP15R3 | RP15R2 | RP15R1 | RP15R0 | — | — | — | RP14R4 | RP14R3 | RP14R2 | RP14R1 | RP14R0 | 0000 |
| RPOR8 | 06D0 | — | — | — | RP17R4(1) | RP17R3(1) | RP17R2(1) | RP17R1(1) | RP17R0(1) | — | — | — | RP16R4(1) | RP16R3(1) | RP16R2(1) | RP16R1(1) | RP16R0(1) | 0000 |
| RPOR9 | 06D2 | — | — | — | RP19R4(1) | RP19R3(1) | RP19R2(1) | RP19R1(1) | RP19R0(1) | — | — | — | RP18R4(1) | RP18R3(1) | RP18R2(1) | RP18R1(1) | RP18R0(1) | 0000 |
| RPOR10 | 06D4 | — | — | — | RP21R4(1) | RP21R3(1) | RP21R2(1) | RP21R1(1) | RP21R0(1) | — | — | — | RP20R4(1) | RP20R3(1) | RP20R2(1) | RP20R1(1) | RP20R0(1) | 0000 |
| RPOR11 | 06D6 | — | — | — | RP23R4(1) | RP23R3(1) | RP23R2(1) | RP23R1(1) | RP23R0(1) | — | — | — | RP22R4(1) | RP22R3(1) | RP22R2(1) | RP22R1(1) | RP22R0(1) | 0000 |
| RPOR12 | 06D8 | — | — | — | RP25R4(1) | RP25R3(1) | RP25R2(1) | RP25R1(1) | RP25R0(1) | — | — | — | RP24R4(1) | RP24R3(1) | RP24R2(1) | RP24R1(1) | RP24R0(1) | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: These bits are only available on 44-pin devices; otherwise, they read as ‘0’.
TABLE 4-22: CLOCK CONTROL REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RCON | 0740 | TRAPR | IOPUWR | — | — | — | — | CM | PMSLP | EXTR | SWR | SWDTEN | WDTO | SLEEP | IDLE | BOR | POR | (Note 1) |
| OSCCON | 0742 | — | COSC2 | COSC1 | COSC0 | — | NOSC2 | NOSC1 | NOSC0 | CLKLOCK | IOLOCK | LOCK | — | CF | — | SOSCEN | OSWEN | (Note 2) |
| CLKDIV | 0744 | ROI | DOZE2 | DOZE1 | DOZE0 | DOZEN | RCDIV2 | RCDIV1 | RCDIV0 | — | — | — | — | — | — | — | — | 3140 |
| OSCTUN | 0748 | — | — | — | — | — | — | — | — | — | — | TUN5 | TUN4 | TUN3 | TUN2 | TUN1 | TUN0 | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: RCON register Reset values are dependent on the type of Reset.
Note 2: OSCCON register Reset values are dependent on configuration fuses and by the type of Reset.
TABLE 4-23: NVM REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NVMCON | 0760 | WR | WREN | WRERR | — | — | — | — | — | — | ERASE | — | — | NVMOP3 | NVMOP2 | NVMOP1 | NVMOP0 | 0000(1) |
| NVMKEY | 0766 | — | — | — | — | — | — | — | — | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1: Reset value shown is for a POR only. The value on other Reset states is dependent on the state of the memory write or erase operations at the time of Reset.
TABLE 4-24: PMD REGISTER MAP
| File Name | Addr | Bit 15 | Bit 14 | Bit 13 | Bit 12 | Bit 11 | Bit 10 | Bit 9 | Bit 8 | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | All Resets |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PMD1 | 0770 | T5MD | T4MD | T3MD | T2MD | T1MD | — | — | — | I2C1MD | U2MD | U1MD | SPI2MD | SPI1MD | — | — | ADC1MD | 0000 |
| PMD2 | 0772 | — | — | — | IC5MD | IC4MD | IC3MD | IC2MD | IC1MD | — | — | — | OC5MD | OC4MD | OC3MD | OC2MD | OC1MD | 0000 |
| PMD3 | 0774 | — | — | — | — | — | CMPMD | RTCCMD | PMPMD | CRCPMD | — | — | — | — | — | I2C2MD | — | 0000 |
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
4.2.5 SOFTWARE STACK
In addition to its use as a working register, the W15 register in PIC24F devices is also used as a Software Stack Pointer. The pointer always points to the first available free word and grows from lower to higher addresses. It pre-decrements for stack pops and post-increments for stack pushes, as shown in Figure 4-4. Note that for a PC push during any CALL instruction, the MSB of the PC is zero-extended before the push, ensuring that the MSB is always clear.
Note: A PC push during exception processing will concatenate the SRL register to the MSB of the PC prior to the push.
The Stack Pointer Limit Value register (SPLIM), associated with the Stack Pointer, sets an upper address boundary for the stack. SPLIM is uninitialized at Reset. As is the case for the Stack Pointer, SPLIM<0> is forced to ‘0’ because all stack operations must be word-aligned. Whenever an EA is generated using W15 as a source or destination pointer, the resulting address is compared with the value in SPLIM. If the contents of the Stack Pointer (W15) and the SPLIM register are equal, and a push operation is performed, a stack error trap will not occur. The stack error trap will occur on a subsequent push operation. Thus, for example, if it is desirable to cause a stack error trap when the stack grows beyond address 2000h in RAM, initialize the SPLIM with the value, 1FFEh.
Similarly, a Stack Pointer underflow (stack error) trap is generated when the Stack Pointer address is found to be less than 0800h. This prevents the stack from interfering with the Special Function Register (SFR) space.
A write to the SPLIM register should not be immediately followed by an indirect read operation using W15.
FIGURE 4-4: CALL STACK FRAME

4.3 Interfacing Program and Data Memory Spaces
The PIC24F architecture uses a 24-bit wide program space and 16-bit wide data space. The architecture is also a modified Harvard scheme, meaning that data can also be present in the program space. To use this data successfully, it must be accessed in a way that preserves the alignment of information in both spaces.
Aside from normal execution, the PIC24F architecture provides two methods by which program space can be accessed during operation:
- Using table instructions to access individual bytes or words anywhere in the program space
- Remapping a portion of the program space into the data space (Program Space Visibility)
Table instructions allow an application to read or write to small areas of the program memory. This makes the method ideal for accessing data tables that need to be updated from time to time. It also allows access to all bytes of the program word. The remapping method allows an application to access a large block of data on a read-only basis, which is ideal for look-ups from a large table of static data. It can only access the least significant word of the program word.
4.3.1 ADDRESSING PROGRAM SPACE
Since the address ranges for the data and program spaces are 16 and 24 bits, respectively, a method is needed to create a 23-bit or 24-bit program address from 16-bit data registers. The solution depends on the interface method to be used.
For table operations, the 8-bit Table Memory Page Address register (TBLPAG) is used to define a 32K word region within the program space. This is concatenated with a 16-bit EA to arrive at a full 24-bit program space address. In this format, the Most Significant bit of TBLPAG is used to determine if the operation occurs in the user memory (TBLPAG<7> = 0) or the configuration memory (TBLPAG<7> = 1).
For remapping operations, the 8-bit Program Space Visibility Page Address register (PSVPAG) is used to define a 16K word page in the program space. When the Most Significant bit of the EA is ‘1’, PSVPAG is concatenated with the lower 15 bits of the EA to form a 23-bit program space address. Unlike table operations, this limits remapping operations strictly to the user memory area.
Table 4-25 and Figure 4-5 show how the program EA is created for table operations and remapping accesses from the data EA. Here, P<23:0> refers to a program space word, whereas D<15:0> refers to a data space word.
TABLE 4-25: PROGRAM SPACE ADDRESS CONSTRUCTION
| Access Type | Access Space | Program Space Address | ||||
|---|---|---|---|---|---|---|
| <23> | <22:16> | <15> | <14:1> | <0> | ||
| Instruction Access (Code Execution) | User | 0 | PC<22:1> | 0 | ||
| 0xx xxxx xxxx xxxx xxxx xxx0 | ||||||
| TBLRD/TBLWT (Byte/Word Read/Write) | User | TBLPAG<7:0> | Data EA<15:0> | |||
| 0xxx xxxx | xxxx xxxx xxxx xxxx | |||||
| Configuration | TBLPAG<7:0> | Data EA<15:0> | ||||
| 1xxx xxxx | xxxx xxxx xxxx xxxx | |||||
| Program Space Visibility (Block Remap/Read) | User | 0 | PSVPAG<7:0> | Data EA<14:0>(1) | ||
| 0 | xxxx xxxx | xxx xxxx xxxx xxxx |
Note 1: Data EA<15> is always ‘1’ in this case, but is not used in calculating the program space address. Bit 15 of the address is PSVPAG<0>.
FIGURE 4-5: DATA ACCESS FROM PROGRAM SPACE ADDRESS GENERATION

Note 1: The LSb of program space addresses is always fixed as ‘0’ in order to maintain word alignment of data in the program and data spaces.
2: Table operations are not required to be word-aligned. Table read operations are permitted in the configuration memory space.
4.3.2 DATA ACCESS FROM PROGRAM MEMORY USING TABLE INSTRUCTIONS
The TBLRDL and TBLWTL instructions offer a direct method of reading or writing the lower word of any address within the program space without going through data space. The TBLRDH and TBLWTH instructions are the only method to read or write the upper 8 bits of a program space word as data.
The PC is incremented by two for each successive 24-bit program word. This allows program memory addresses to directly map to data space addresses. Program memory can thus be regarded as two 16-bit word-wide address spaces, residing side by side, each with the same address range. TBLRDL and TBLWTL access the space which contains the least significant data word, and TBLRDH and TBLWTH access the space which contains the upper data byte.
Two table instructions are provided to move byte or word-sized (16-bit) data to and from program space. Both function as either byte or word operations.
-
TBLRDL (Table Read Low): In Word mode, it maps the lower word of the program space location (P<15:0>) to a data address (D<15:0>). In Byte mode, either the upper or lower byte of the lower program word is mapped to the lower byte of a data address. The upper byte is selected when byte select is ‘1’; the lower byte is selected when it is ‘0’.
-
TBLRDH (Table Read High): In Word mode, it maps the entire upper word of a program address (P<23:16>) to a data address. Note that D<15:8>, the ‘phantom’ byte, will always be ‘0’. In Byte mode, it maps the upper or lower byte of the program word to D<7:0> of the data address, as above. Note that the data will always be ‘0’ when the upper ‘phantom’ byte is selected (Byte Select = 1).
In a similar fashion, two table instructions, TBLWTH and TBLWTL, are used to write individual bytes or words to a program space address. The details of their operation are explained in Section 5.0 “Flash Program Memory”.
For all table operations, the area of program memory space to be accessed is determined by the Table Memory Page Address register (TBLPAG). TBLPAG covers the entire program memory space of the device, including user and configuration spaces. When TBLPAG<7> = 0, the table page is located in the user memory space. When TBLPAG<7> = 1, the page is located in configuration space.
Note: Only table read operations will execute in the configuration memory space, and only then, in implemented areas, such as the Device ID. Table write operations are not allowed.
FIGURE 4-6: ACCESSING PROGRAM MEMORY WITH TABLE INSTRUCTIONS

The address for the table operation is determined by the data EA within the page defined by the TBLPAG register. Only read operations are shown; write operations are also valid in the user memory area.
4.3.3 READING DATA FROM PROGRAM MEMORY USING PROGRAM SPACE VISIBILITY
The upper 32 Kbytes of data space may optionally be mapped into any 16K word page of the program space. This provides transparent access of stored constant data from the data space without the need to use special instructions (i.e., TBLRDL/H).
Program space access through the data space occurs if the Most Significant bit of the data space EA is '1' and Program Space Visibility is enabled by setting the PSV bit in the CPU Control register (CORCON<2>). The location of the program memory space to be mapped into the data space is determined by the Program Space Visibility Page Address register (PSVPAG). This 8-bit register defines any one of 256 possible pages of 16K words in program space. In effect, PSVPAG functions as the upper 8 bits of the program memory address, with the 15 bits of the EA functioning as the lower bits. Note that by incrementing the PC by 2 for each program memory word, the lower 15 bits of data space addresses directly map to the lower 15 bits in the corresponding program space addresses.
Data reads to this area add an additional cycle to the instruction being executed, since two program memory fetches are required.
Although each data space address, 8000h and higher, maps directly into a corresponding program memory address (see Figure 4-7), only the lower 16 bits of the 24-bit program word are used to contain the data. The upper 8 bits of any program space locations used as data should be programmed with '1111 1111' or '0000 0000' to force a NOP. This prevents possible issues should the area of code ever be accidentally executed.
Note: PSV access is temporarily disabled during table reads/writes.
For operations that use PSV and are executed outside a REPEAT loop, the MOV and MOV.D instructions will require one instruction cycle in addition to the specified execution time. All other instructions will require two instruction cycles in addition to the specified execution time.
For operations that use PSV which are executed inside a REPEAT loop, there will be some instances that require two instruction cycles in addition to the specified execution time of the instruction:
- Executation in the first iteration
- Executation in the last iteration
- Executation prior to exiting the loop due to an interrupt
- Executation upon re-entering the loop after an interrupt is serviced
Any other iteration of the REPEAT loop will allow the instruction accessing data, using PSV, to execute in a single cycle.
FIGURE 4-7: PROGRAM SPACE VISIBILITY OPERATION

DS39881E-page 46 © 2010-2013 Microchip Technology Inc.