The device names, pin counts, memory sizes and peripheral availability of each device are listed in Tab le 1. The following pages show the devices’ pinout diagrams.
2.0Guidelines for Getting Started with 16-Bit Digital Signal Controllers.......................................................................................... 17
5.0Flash Program Memory.............................................................................................................................................................. 81
22.0 Controller Area Network (CAN) Module (dsPIC33EVXXXGM10X Devices Only).................................................................... 251
23.0 Charge Time Measurement Unit (CTMU) ................................................................................................................................ 277
25.0 Op Amp/Comparator Module ................................................................................................................................................... 299
26.0 Comparator Voltage Reference ................................................................................................................................................ 311
27.0 Special Features ...................................................................................................................................................................... 315
28.0 Instruction Set Summary .......................................................................................................................................................... 325
29.0 Development Support............................................................................................................................................................... 335
Index ................................................................................................................................................................................................. 433
The Microchip Web Site..................................................................................................................................................................... 439
Customer Change Notification Service .............................................................................................................................................. 439
Customer Support .............................................................................................................................................................................. 439
DS70005144C-page 10 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
TO OUR VALUED CUSTOMERS
It is our intention to provide our valued customers with the best documentation possible to ensure successful use of your Microchip
products. To this end, we will continue to improve our publications to better suit your needs. Our publications will be refined and
enhanced as new volumes and updates are introduced.
If you have any questions or comments regarding this publication, please contact the Marketing Communications Department via
E-mail at docerrors@microchip.com. We welcome your feedback.
Most Current Data Sheet
To obtain the most up-to-date version of this data sheet, please register at our Worldwide Web site at:
http://www.microchip.com
You can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page.
The last character of the literature number is the version number, (e.g., DS30000000A is version A of document DS30000000).
Errata
An errata sheet, describing minor operational differences from the data sheet and recommended workarounds, may exist for current
devices. As device/documentation issues become known to us, we will publish an errata sheet. The errata will specify the revision
of silicon and revision of document to which it applies.
To determine if an errata sheet exists for a particular device, please check with one of the following:
• Microchip’s Worldwide Web site; http://www.microchip.com
• Your local Microchip sales office (see last page)
When contacting a sales office, please specify which device, revision of silicon and data sheet (include literature number) you are
using.
Customer Notification System
Register on our web site at www.microchip.com to receive the most current information on all of our products.
This device data sheet is based on the following
individual chapters of the “dsPIC33/PIC24 FamilyReference Manual”, which are available from the
Microchip web site (www.microchip.com). The follow-
ing documents should be considered as the general
reference for the operation of a particular module or
device feature:
• “Introduction” (DS70573)
• “CPU” (DS70359)
• “Data Memory” (DS70595)
• “Program Memory” (DS70613)
• “Flash Programming” (DS70609)
• “Interrupts” (DS70000600)
• “Oscillator” (DS70580)
• “Reset” (DS70602)
• “Watchdog Timer and Power-Saving Modes” (DS70615)
DS70005144C-page 12 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
PORTA
Power-up
Timer
Oscillator
Start-up
OSC1/CLKI
MCLR
VDD, VSS
UART1/2
Timing
Generation
CAN1
(1)
I2C1
ADC
Timers
Input
Capture
Output
Compare
AV
DD, AVSS
SPI1/2
Watchdog
Timer/
POR/BOR
PWM
Remappable
Pins
Note 1:This feature or peripheral is only available on dsPIC33EVXXXGM10X devices.
CTMU
SENT1/2
CPU
Refer to Figure 3-1 for CPU diagram details.
16
16
PORTB
PORTC
PORTD
PORTE
PORTF
PORTG
PORTS
Peripheral Modules
Timer
Deadman
Op Amp/
Comparator
Timer
1.0DEVICE OVERVIEW
This document contains device-specific information for
the dsPIC33EVXXXGM00X/10X family Digital Signal
Note 1: This data sheet summarizes the features
of the dsPIC33EVXXXGM00X/10X family
of devices. It is not intended to be a
comprehensive reference source. To
complement the information in this data
sheet, refer to the related section in the
“dsPIC33/PIC24 Family Reference Manual”, which is available from the Microchip
Controller (DSC) devices.
dsPIC33EVXXXGM00X/10X family devices contain
extensive Digital Signal Processor (DSP) functionality
with a high-performance, 16-bit MCU architecture.
Figure 1-1 shows a general block diagram of the core
and peripheral modules. Table 1-1 lists the functions of
the various pins shown in the pinout diagrams.
web site (www.microchip.com).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
Section 4.0 “Memory Organization” in
this data sheet for device-specific register
and bit information.
FIGURE 1-1:dsPIC33EVXXXGM00X/10X FAMILY BLOCK DIAGRAM
NoNoExternal clock source input. Always associated with OSC1 pin
function.
Oscillator crystal output. Connects to crystal or resonator in Crystal
Oscillator mode. Optionally functions as CLKO in RC and EC modes.
Always associated with OSC2 pin function.
NoNoOscillator crystal input. ST buffer when configured in RC mode; CMOS
otherwise.
Oscillator crystal output. Connects to crystal or resonator in Crystal
Oscillator mode. Optionally functions as CLKO in RC and EC modes.
Compare Fault A input (for compare channels).
Yes
Compare Outputs 1 to 4.
No
External Interrupt 0.
Yes
External Interrupt 1.
Yes
External Interrupt 2.
No
Timer1 external clock input.
Yes
Timer2 external clock input.
No
Timer3 external clock input.
No
Timer4 external clock input.
No
Timer5 external clock input.
No
CTMU pulse output.
No
CTMU External Edge Input 1.
No
CTMU External Edge Input 2.
Yes
UART1 Clear-to-Send.
Yes
UART1 Ready-to-Send.
Yes
UART1 receive.
Yes
UART1 transmit.
Yes
UART2 Clear-to-Send.
Yes
UART2 Ready-to-Send.
Yes
UART2 receive.
Yes
UART2 transmit.
No
Synchronous serial clock input/output for SPI1.
No
SPI1 data in.
No
SPI1 data out.
No
SPI1 slave synchronization or frame pulse I/O.
DS70005144C-page 14 2013-2014 Microchip Technology Inc.
I/PSTNo Master Clear (Reset) input. This pin is an active-low Reset to the
ST
Yes
I
ST
Yes
O
O
O
O
O
O
O
—
Yes
ST
Yes
ST
ST
ST
ST
I
ST—Yes
—
I
—
—
I
—
IOAnalog—No
IOAnalog—No
IOAnalog—No
IOAnalog—No
IOAnalog—No
I
ST
I
ST
I
ST
I
ST
—
—
I
ST
—
ST
ST
I
ST
ST
I
ST
ST
I
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
NO
NO
Yes
No
No
Yes
Yes
No
No
No
No
No
No
Synchronous serial clock input/output for SPI2.
SPI2 data in.
SPI2 data out.
SPI2 slave synchronization or frame pulse I/O.
Synchronous serial clock input/output for I2C1.
Synchronous serial data input/output for I2C1.
Alternate synchronous serial clock input/output for I2C1.
Alternate synchronous serial data input/output for I2C1.
PWM Fault Inputs 1 and 2.
PWM Fault Inputs 3 to 8.
PWM Fault Input 32.
PWM dead-time compensation input.
PWM Low Outputs 1 to 3.
PWM High Outputs 1 to 3.
PWM Synchronization Input 1.
PWM Synchronization Output 1.
Data I/O pin for Programming/Debugging Communication Channel 1.
Clock input pin for Programming/Debugging Communication Channel 1.
Data I/O pin for Programming/Debugging Communication Channel 2.
Clock input pin for Programming/Debugging Communication Channel 2.
Data I/O pin for Programming/Debugging Communication Channel 3.
Clock input pin for Programming/Debugging Communication Channel 3.
DS70005144C-page 16 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
2.0GUIDELINES FOR GETTING
STARTED WITH 16-BIT
DIGITAL SIGNAL
CONTROLLERS
Note 1: This data sheet summarizes the features
of the dsPIC33EVXXXGM00X/10X family
of devices. It is not intended to be a
comprehensive reference source. To
complement the information in this data
sheet, refer to the related section in the
“dsPIC33/PIC24 Family Reference Manual”, which is available from the Microchip
web site (www.microchip.com).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
Section 4.0 “Memory Organization” in
this data sheet for device-specific register
and bit information.
2.1Basic Connection Requirements
Getting started with the dsPIC33EVXXXGM00X/10X
family of 16-bit microcontrollers (MCUs) requires
attention to a minimal set of device pin connections
before proceeding with development. The following is a
list of pin names, which must always be connected:
DD and VSS pins
•All V
(see Section 2.2 “Decoupling Capacitors”)
•All AV
•V
•MCLR
• PGECx/PGEDx pins used for In-Circuit Serial
• OSC1 and OSC2 pins when external oscillator
DD and AVSS pins (regardless if ADC module
is not used)
(see Section 2.2 “Decoupling Capacitors”)
CAP
(see Section 2.3 “CPU Logic Filter Capacitor
Connection (VCAP)”)
pin
(see Section 2.4 “Master Clear (MCLR) Pin”)
Programming™ (ICSP™) and debugging purposes
(see Section 2.5 “ICSP Pins”)
source is used
(see Section 2.6 “External Oscillator Pins”)
2.2Decoupling Capacitors
The use of decoupling capacitors on every pair of
power supply pins, such as V
SS, is required.
AV
Consider the following criteria when using decoupling
capacitors:
• Value and type of capacitor: A value of 0.1 µF
(100 nF), 10V-20V is recommended. This
capacitor should be a Low Equivalent Series
Resistance (low-ESR), and have resonance
frequency in the range of 20 MHz and higher. It is
recommended to use ceramic capacitors.
• Placement on the Printed Circuit Board (PCB):
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 within
one-quarter inch (6 mm) in length.
• Handling high-frequency noise: If the board is
experiencing high-frequency noise, above 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 the 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.
For example, 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 the PCB track
inductance.
DD, VSS, AVDD and
Note:The AV
connected, regardless of the ADC voltage
reference source.
Note 1: As an option, instead of a hard-wired connection, an
inductor (L1) can be substituted between V
DD and
AV
DD to improve ADC noise rejection. The inductor
impedance should be less than 1 and the inductor
capacity greater than 10 mA.
Where:
f
FCNV
2
--------------=
f
1
2 LC
------------- ----------=
L
1
2fC
----------------------
2
=
(i.e., ADC Conversion Rate/2)
Note 1: R 10 k is recommended. A suggested
starting value is 10 k. Ensure that the MCLR
pin V
IH and VIL specifications are met.
2: R1 470 will limit any current flow 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 VIL specifications are met.
C
R1
(2)
R
(1)
VDD
MCLR
dsPIC33EV
JP
FIGURE 2-1:RECOMMENDED
MINIMUM CONNECTION
The placement of this capacitor should be close to the
CAP pin. It is recommended that the trace length
V
should not exceed one-quarter inch (6 mm).
2.4Master Clear (MCLR) Pin
The MCLR pin provides two specific device
functions:
• Device Reset
• Device Programming and Debugging
During device programming and debugging, the
resistance and capacitance that can be added to the
pin must be considered. Device programmers and
debuggers drive the MCLR
specific voltage levels (V
transitions must not be adversely affected. Therefore,
specific values of R and C will need to be adjusted
based on the application and PCB requirements.
For example, as shown in Figure 2-1, it is
recommended that the capacitor, C, be isolated from
the MCLR
pin during programming and debugging
operations.
Place the components as shown in Figure 2-2 within
one-quarter inch (6 mm) from the MCLR
pin. Consequently,
IH and VIL) and fast signal
pin.
2.2.1TANK 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 DSCs 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.3CPU Logic Filter Capacitor
A low-ESR (<1 Ohms) capacitor is required on the VCAP
pin, which is used to stabilize the internal voltage regulator
output. The V
must have a capacitor greater than 4.7 µF (10 µF is
recommended), with at least a 16V rating connected to
the ground. The type can be ceramic or tantalum. See
Section 30.0 “Electrical Characteristics” for additional
information.
DS70005144C-page 18 2013-2014 Microchip Technology Inc.
Connection (V
CAP pin must not be connected to VDD, and
CAP)
FIGURE 2-2:EXAMPLE OF MCLR PIN
CONNECTIONS
dsPIC33EVXXXGM00X/10X FAMILY
Main Oscillator
Guard Ring
Guard Trace
Oscillator Pins
2.5ICSP Pins
The PGECx and PGEDx pins are used for 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 exceeding 100 Ohms.
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 Voltage Input High
IH) and Voltage Input Low (VIL) requirements.
(V
Ensure that the “Communication Channel Select” (i.e.,
PGECx/PGEDx pins) programmed into the device
matches the physical connections for the ICSP to
MPLAB
REAL ICE™.
For more information on MPLAB ICD 2, ICD 3 and
REAL ICE connection requirements, refer to the
following documents that are available on the
Microchip web site (www.microchip.com).
• “Using MPLAB
• “MPLAB® ICD 3 Design Advisory” (DS51764)
• “MPLAB® REAL ICE™ In-Circuit Emulator User’s
• “Using MPLAB
®
PICkit™ 3, MPLAB ICD 3 or MPLAB
®
ICD 3” (poster) (DS51765)
Guide” (DS51616)
(poster) (DS51749)
®
REAL ICE™ In-Circuit Emulator”
2.6External Oscillator Pins
FIGURE 2-3:SUGGESTED PLACEMENT
OF THE OSCILLATOR
CIRCUIT
2.7Oscillator Value Conditions on
Device Start-up
If the PLL of the target device is enabled and
configured for the device start-up oscillator, the
maximum oscillator source frequency must be limited
to 5 MHz < F
start-up conditions. This intends that, if the external
oscillator frequency is outside this range, the
application must start up in the FRC mode first. The
default PLL settings after a POR with an oscillator
frequency outside this range will violate the device
operating speed.
Once the device powers up, the application firmware
can initialize the PLL SFRs, CLKDIV and PLLFBD, to a
suitable value, and then perform a clock switch to the
Oscillator + PLL clock source.
Note:Clock switching must be enabled in the
IN < 13.6 MHz to comply with device PLL
device Configuration Word.
Many DSCs have options for at least two oscillators: a
high-frequency primary oscillator and a low-frequency
secondary oscillator. For more information, see
Section 9.0 “Oscillator Configuration”.
The oscillator circuit should be placed on the same
side of the board as the device. Also, place the
oscillator circuit close to the respective oscillator pins,
not exceeding one-half inch (12 mm) distance
between them. 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 them 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 as
shown in Figure 2-3.
Unused I/O pins should be configured as outputs and
driven to a logic low state.
Alternatively, connect a 1k to 10k resistor between V
and unused pins, and drive the output to logic low.
SS
dsPIC33EVXXXGM00X/10X FAMILY
NOTES:
DS70005144C-page 20 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
3.0CPU
Note 1: This data sheet summarizes the features
of the dsPIC33EVXXXGM00X/10X family
of devices. It is not intended to be a
comprehensive reference source. To
complement the information in this data
sheet, refer to “CPU” (DS70359) in the
“dsPIC33/PIC24 Family ReferenceManual”, which is available from the
Microchip web site (www.microchip.com).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
Section 4.0 “Memory Organization” in
this data sheet for device-specific register
and bit information.
The CPU has a 16-bit (data) modified Harvard architecture with an enhanced instruction set, including
significant support for digital signal processing. The
CPU has a 24-bit instruction word with a variable length
opcode field. The Program Counter (PC) is 23 bits wide
and addresses up to 4M x 24 bits of user program
memory space.
An instruction prefetch mechanism helps maintain
throughput and provides predictable execution. Most
instructions execute in a single-cycle effective execution rate, with the exception of instructions that change
the program flow, the double-word move (MOV.D)
instruction, PSV accesses and the table instructions.
Overhead-free program loop constructs are supported
using the DO and REPEAT instructions, both of which
are interruptible at any point.
3.1Registers
The dsPIC33EVXXXGM00X/10X family 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 sixteenth
Working register (W15) operates as a Software Stack
Pointer for interrupts and calls.
In addition, the dsPIC33EVXXXGM00X/10X devices
include two alternate Working register sets, which
consist of W0 through W14. The alternate registers can
be made persistent to help reduce the saving and
restoring of register content during Interrupt Service
Routines (ISRs). The alternate Working registers can
be assigned to a specific Interrupt Priority Level (IPL1
through IPL6) by configuring the CTXTx<2:0> bits in
the FALTREG Configuration register.
The alternate Working registers can also be accessed
manually by using the CTXTSWP instruction.
The CCTXI<2:0> and MCTXI<2:0> bits in the CTXTSTAT
register can be used to identify the current, and most
recent, manually selected Working register sets.
3.2Instruction Set
The device instruction set has two classes of instructions: the MCU class of instructions and the DSP class
of instructions. These two instruction classes are
seamlessly integrated into the architecture and execute from a single execution unit. The instruction set
includes many addressing modes and was designed
for optimum C compiler efficiency.
3.3Data Space Addressing
The Base Data Space can be addressed as 4K words
or 8 Kbytes and is split into two blocks, referred to as X
and Y data memory. Each memory block has its own
independent Address Generation Unit (AGU). The
MCU class of instructions operates solely through the
X memory AGU, which accesses the entire memory
map as one linear Data Space. On dsPIC33EV
devices, certain DSP instructions operate through the
X and Y AGUs to support dual operand reads, which
splits the data address space into two parts. The X and
Y Data Space boundary is device-specific.
The upper 32 Kbytes of the Data Space (DS) memory
map can optionally be mapped into Program Space (PS)
at any 16K program word boundary. The Program-toData Space mapping feature, known as Program Space
Visibility (PSV), lets any instruction access Program
Space as if it were Data Space. Moreover, the Base Data
Space address is used in conjunction with a Data Space
Read or Write Page register (DSRPAG or DSWPAG) to
form an Extended Data Space (EDS) address. The EDS
can be addressed as 8M words or 16 Mbytes. For more
information on EDS, PSV and table accesses, refer to
“Data Memory” (DS70595) and “Program Memory”
(DS70613) in the “dsPIC33/PIC24 Family ReferenceManual”.
On dsPIC33EV devices, overhead-free circular buffers
(Modulo Addressing) are supported in both X and Y
address spaces. The Modulo Addressing removes the
software boundary checking overhead for DSP
algorithms. The X AGU Circular Addressing can be
used with any of the MCU class of instructions. The X
AGU also supports Bit-Reversed Addressing to greatly
simplify input or output data reordering for radix-2 FFT
algorithms. Figure 3-1 illustrates the block diagram of
the dsPIC33EVXXXGM00X/10X family devices.
3.4Addressing Modes
The CPU supports these addressing modes:
• Inherent (no operand)
• Relative
•Literal
• Memory Direct
• Register Direct
• Register Indirect
Each instruction is associated with a predefined
addressing mode group, depending upon its functional
requirements. As many as six addressing modes are
supported for each instruction.
FIGURE 3-1:dsPIC33EVXXXGM00X/10X FAMILY CPU BLOCK DIAGRAM
DS70005144C-page 22 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
3.5Programmer’s Model
The programmer’s model for the dsPIC33EVXXXGM00X/
10X family is shown in Figure 3-2. All registers in the
programmer’s model are memory-mapped and can be
manipulated directly by instructions. Table 3-1 lists a
description of each register.
In addition to the registers contained in the
programmer’s model, the dsPIC33EVXXXGM00X/10X
family devices contain control registers for Modulo
Addressing and Bit-Reversed Addressing, and
interrupts. These registers are described in subsequent
sections of this document.
All registers associated with the programmer’s model
are memory-mapped, as shown in Table 4-1.
TABLE 3-1:PROGRAMMER’S MODEL REGISTER DESCRIPTIONS
Register(s) NameDescription
W0 through W15
W0 through W14
W0 through W14
ACCA, ACCB40-Bit DSP Accumulators
PC23-Bit Program Counter
SRALU and DSP Engine STATUS Register
SPLIMStack Pointer Limit Value Register
TBLPAGTable Memory Page Address Register
DSRPAGExtended Data Space (EDS) Read Page Register
RCOUNTREPEAT Loop Count Register
DCOUNTDO Loop Count Register
DOSTARTH
DOENDH, DOENDLDO Loop End Address Register (High and Low)
CORCONContains DSP Engine, DO Loop Control and Trap Status bits
Note 1:Memory-mapped W0 through W14 represents the value of the register in the currently active CPU context.
2:The DOSTARTH and DOSTARTL registers are read-only.
DS70005144C-page 24 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
3.6CPU Control Registers
REGISTER 3-1:SR: CPU STATUS REGISTER
R/W-0R/W-0R/W-0R/W-0R/C-0R/C-0R-0R/W-0
OAOBSA
(3)
bit 15bit 8
R/W-0R/W-0R/W-0R-0R/W-0R/W-0R/W-0R/W-0
IPL2
(1,2)
IPL1
(1,2)
IPL0
(1,2)
bit 7bit 0
Legend:C = Clearable bit
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15OA: Accumulator A Overflow Status bit
1 = Accumulator A has overflowed
0 = Accumulator A has not overflowed
bit 14OB: Accumulator B Overflow Status bit
1 = Accumulator B has overflowed
0 = Accumulator B has not overflowed
bit 13SA: Accumulator A Saturation ‘Sticky’ Status bit
1 = Accumulator A is saturated or has been saturated at some time
0 = Accumulator A is not saturated
bit 12SB: Accumulator B Saturation ‘Sticky’ Status bit
1 = Accumulator B is saturated or has been saturated at some time
0 = Accumulator B is not saturated
bit 11OAB: OA || OB Combined Accumulator Overflow Status bit
1 = Accumulator A or B has overflowed
0 = Accumulator A and B have not overflowed
bit 10SAB: SA || SB Combined Accumulator ‘Sticky’ Status bit
1 = Accumulator A or B is saturated or has been saturated at some time
0 = Accumulator A and B have not been saturated
bit 9DA: DO Loop Active bit
1 = DO loop is in progress
0 = DO loop is not in progress
bit 8DC: MCU ALU Half Carry/Borrow
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 low-order bit (for byte-sized data) or 8th low-order bit (for word-sized
data) of the result occurred
(3)
SB
OABSABDADC
RANOVZC
(3)
(3)
bit
Note 1:The IPL<2:0> bits are concatenated with the IPL3 bit (CORCON<3>) to form the CPU Interrupt Priority
Level. The value in parentheses indicates the IPL if IPL3 = 1. User interrupts are disabled when IPL3 = 1.
2:The IPL<2:0> Status bits are read-only when the NSTDIS bit (INTCON1<15>) = 1.
3:A data write to the SR register can modify the SA and SB bits by either a data write to SA and SB or by
clearing the SAB bit. To avoid a possible SA or SB bit write race condition, the SA and SB bits should not
be modified using the bit operations.
bit 7-5IPL<2:0>: CPU Interrupt Priority Level Status bits
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 4RA: REPEAT Loop Active bit
1 = REPEAT loop is in progress
0 = REPEAT loop is not in progress
bit 3N: MCU ALU Negative bit
1 = Result was negative
0 = Result was non-negative (zero or positive)
bit 2OV: MCU ALU Overflow bit
This bit is used for signed arithmetic (2’s complement). It indicates an overflow of the magnitude that
causes the sign bit to change state.
1 = Overflow occurred for signed arithmetic (in this arithmetic operation)
0 = Overflow has not occurred for signed arithmetic
bit 1Z: MCU ALU Zero bit
1 = An operation that affects the Z bit has set it at some time in the past
0 = The most recent operation that affects the Z bit has cleared it (i.e., a non-zero result)
bit 0C: MCU ALU Carry/Borrow
1 = A carry-out from the Most Significant bit (MSb) of the result occurred
0 = No carry-out from the Most Significant bit of the result occurred
bit
(1,2)
Note 1:The IPL<2:0> bits are concatenated with the IPL3 bit (CORCON<3>) to form the CPU Interrupt Priority
Level. The value in parentheses indicates the IPL if IPL3 = 1. User interrupts are disabled when IPL3 = 1.
2:The IPL<2:0> Status bits are read-only when the NSTDIS bit (INTCON1<15>) = 1.
3:A data write to the SR register can modify the SA and SB bits by either a data write to SA and SB or by
clearing the SAB bit. To avoid a possible SA or SB bit write race condition, the SA and SB bits should not
be modified using the bit operations.
DS70005144C-page 26 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
REGISTER 3-2:CORCON: CORE CONTROL REGISTER
R/W-0U-0R/W-0R/W-0R/W-0R-0R-0R-0
(1)
(1)
(2)
DL2DL1DL0
SFARNDIF
VAR
bit 15bit 8
R/W-0R/W-0R/W-1R/W-0R/C-0R-0R/W-0R/W-0
SATASATBSATDWACCSATIPL3
bit 7bit 0
Legend:C = Clearable bit
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15VAR: Variable Exception Processing Latency Control bit
bit 14Unimplemented: Read as ‘0’
bit 13-12US<1:0>: DSP Multiply Unsigned/Signed Control bits
bit 11EDT: Early DO Loop Termination Control bit
bit 10-8DL<2:0>: DO Loop Nesting Level Status bits
bit 7SATA: ACCA Saturation Enable bit
bit 6SATB: ACCB Saturation Enable bit
bit 5SATDW: Data Space Write from DSP Engine Saturation Enable bit
bit 4ACCSAT: Accumulator Saturation Mode Select bit
—US1US0EDT
1 = Variable exception processing latency is enabled
0 = Fixed exception processing latency is enabled
11 = Reserved
10 = DSP engine multiplies are mixed-sign
01 = DSP engine multiplies are unsigned
00 = DSP engine multiplies are signed
1 = Terminates executing DO loop at the end of current loop iteration
0 = No effect
111 = 7 DO loops are active
•
•
•
001 = 1 DO loop is active
000 = 0 DO loops are active
1 = Accumulator A saturation is enabled
0 = Accumulator A saturation is disabled
1 = Accumulator B saturation is enabled
0 = Accumulator B saturation is disabled
1 = Data Space write saturation is enabled
0 = Data Space write saturation is disabled
REGISTER 3-2:CORCON: CORE CONTROL REGISTER (CONTINUED)
bit 3IPL3: CPU Interrupt Priority Level Status bit 3
1 = CPU Interrupt Priority Level is greater than 7
0 = CPU Interrupt Priority Level is less than 7
bit 2SFA: Stack Frame Active Status bit
1 = Stack frame is active; W14 and W15 address 0x0000 to 0xFFFF, regardless of DSRPAG and
DSWPAG values
0 = Stack frame is not active; W14 and W15 address of EDS or Base Data Space
bit 1RND: Rounding Mode Select bit
1 = Biased (conventional) rounding is enabled
0 = Unbiased (convergent) rounding is enabled
bit 0IF: Integer or Fractional Multiplier Mode Select bit
1 = Integer mode is enabled for DSP multiply
0 = Fractional mode is enabled for DSP multiply
Note 1:This bit is always read as ‘0’.
2:The IPL3 bit is concatenated with the IPL<2:0> bits (SR<7:5>) to form the CPU Interrupt Priority Level.
(2)
DS70005144C-page 28 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
REGISTER 3-3:CTXTSTAT: CPU W REGISTER CONTEXT STATUS REGISTER
U-0U-0U-0U-0U-0R-0R-0R-0
—————CCTXI2CCTXI1CCTXI0
bit 15bit 8
U-0U-0U-0U-0U-0R-0R/W-0R/W-0
—————MCTXI2MCTXI1MCTXI0
bit 7bit 0
Legend:
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15-11Unimplemented: Read as ‘0’
bit 10-8CCTXI<2:0>: Current (W Register) Context Identifier bits
111 = Reserved
•
•
•
011 = Reserved
010 = Alternate Working Register Set 2 is currently in use
001 = Alternate Working Register Set 1 is currently in use
000 = Default register set is currently in use
bit 7-3Unimplemented: Read as ‘0’
bit 2-0MCTXI<2:0>: Manual (W Register) Context Identifier bits
111 = Reserved
•
•
•
011 = Reserved
010 = Alternate Working Register Set 2 was most recently manually selected
001 = Alternate Working Register Set 1 was most recently manually selected
000 = Default register set was most recently manually selected
The dsPIC33EVXXXGM00X/10X family ALU is 16 bits
wide and is capable of addition, subtraction, bit shifts
and logic operations. Unless otherwise mentioned,
arithmetic operations are two’s complement in nature.
Depending on the operation, the ALU can 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
and Digit Borrow bits, respectively, for
Borrow
subtraction operations.
The ALU can perform 8-bit or 16-bit operations,
depending on the mode of the instruction that is used.
The data for the ALU operation can come from the W
register array or from the data memory, depending on
the addressing mode of the instruction. Similarly, the
output data from the ALU can be written to the W
register array or a data memory location.
For information on the SR bits affected by each
instruction, refer to the “16-bit MCU and DSCProgrammer’s Reference Manual” (DS70157).
The core CPU incorporates hardware support for both
multiplication and division. This includes a dedicated
hardware multiplier and support hardware for 16-bit
divisor division.
3.7.1MULTIPLIER
Using the high-speed, 17-bit x 17-bit multiplier, the ALU
supports unsigned, signed or mixed-sign operation in
several MCU multiplication modes:
• 16-bit x 16-bit signed
• 16-bit x 16-bit unsigned
• 16-bit signed x 5-bit (literal) unsigned
• 16-bit signed 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.8DSP Engine
The DSP engine consists of a high-speed, 17-bit x 17-bit
multiplier, a 40-bit barrel shifter and a 40-bit adder/
subtracter (with two target accumulators, round and
saturation logic).
The DSP engine can also perform inherent accumulatorto-accumulator operations that require no additional
data. These instructions are ADD, SUB and NEG.
The DSP engine has options selected through bits in
the CPU Core Control register (CORCON) as follows:
• Fractional or Integer DSP Multiply (IF)
• Signed, Unsigned or Mixed-Sign DSP Multiply (US)
• Conventional or Convergent Rounding (RND)
• Automatic Saturation On/Off for ACCA (SATA)
• Automatic Saturation On/Off for ACCB (SATB)
• Automatic Saturation On/Off for Writes to Data
Memory (SATDW)
• Accumulator Saturation mode Selection
(ACCSAT)
TABLE 3-2:DSP INSTRUCTIONS
SUMMARY
Instruction
CLRA = 0Yes
EDA = (x – y)
EDACA = A + (x – y)
MACA = A + (x • y)Yes
MACA = A + x
MOVSACNo change in AYes
MPYA = x • yNo
MPYA = x
MPY.NA = – x • yNo
MSCA = A – x • yYe s
Algebraic
Operation
2
2
2
2
ACC Write
Back
No
No
No
No
3.7.2DIVIDER
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. The 16-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 the single-cycle per bit of
the divisor, so both 32-bit/16-bit and 16-bit/16-bit
instructions take the same number of cycles to
execute.
DS70005144C-page 30 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
Reset Address
0x000000
0x000002
User Program
Flash Memory
0x00AB80
0x00AB7E
(21696 instructions)
0x800000
DEVID
0xFEFFFE
0xFF0000
0xFFFFFE
Unimplemented
(Read ‘0’s)
GOTO Instruction
0x000004
Reserved
0x7FFFFE
0x000200
0x0001FE
Interrupt Vector Table
Configuration Memory SpaceUser Memory Space
Device Configuration
0x00AC00
0x00ABFE
Reserved
0xFF0002
Note 1:Memory areas are not shown to scale.
0xFF0004
Executive Code Memory
0x801000
0x800FFE
User OTP Memory
0xF9FFFE
0xFA0000
0xFA0002
0xFA0004
Write Latches
Reserved
0x800F80
Reserved
0x800BFE
0x800C00
4.0MEMORY ORGANIZATION
Note:This data sheet summarizes the features of
the dsPIC33EVXXXGM00X/10X family
of devices. It is not intended to be a
comprehensive reference source. To
complement the information in this data
sheet, refer to “Program Memory”
(DS70613) in the “dsPIC33/PIC24Family Reference Manual”, which is
available from the Microchip web site
(www.microchip.com).
The dsPIC33EVXXXGM00X/10X family architecture
features separate program and data memory spaces
and buses. This architecture also allows the direct
access of program memory from the Data Space (DS)
during code execution.
4.1Program Address Space
The program address memory space of the
dsPIC33EVXXXGM00X/10X family devices is 4M
instructions. The space is addressable by a 24-bit
value derived either from the 23-bit PC, during program
execution or from table operation, or from DS
remapping, as described in Section 4.7 “Interfacing
Program and Data Memory Spaces”.
User application access to the program memory space
is restricted to the lower half of the address range
(0x000000 to 0x02ABFF). The exception is the use of
the TBLRD operations, which use TBLPAG<7> to read
Device ID sections of the configuration memory space
and the TBLWT operations, which are used to set up the
write latches located in configuration memory space.
The program memory maps, which are presented by
the device family and memory size, are shown in
Figure 4-1 through Figure 4-3.
FIGURE 4-1:PROGRAM MEMORY MAP FOR dsPIC33EV64GM00X/10X DEVICES
The program memory space is organized in wordaddressable 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 (see Figure 4-4).
Program memory addresses are always word-aligned
on the lower word and addresses are incremented or
decremented by two during the code execution. This
4.1.2INTERRUPT AND TRAP VECTORS
All dsPIC33EVXXXGM00X/10X family devices reserve
the addresses between 0x000000 and 0x000200 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 application at address, 0x000000 of Flash
memory, with the actual address for the start of code at
address, 0x000002 of Flash memory.
For more information on the Interrupt Vector Tables,
see Section 7.1 “Interrupt Vector Table”.
arrangement provides compatibility with the Data
Memory Space Addressing and makes data in the
program memory space accessible.
FIGURE 4-4:PROGRAM MEMORY ORGANIZATION
DS70005144C-page 34 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
4.2Data Address Space
The dsPIC33EVXXXGM00X/10X family CPU has a
separate, 16-bit wide data memory space. The Data
Space (DS) is accessed using separate Address Generation Units (AGUs) for read and write operations. The
data memory maps, which are presented by device
family and memory size, are shown in Figure 4-5 and
Figure 4-6.
All Effective Addresses (EAs) in the data memory space
are 16 bits wide and point to bytes within the DS. This
arrangement gives a Base Data Space address range of
64 Kbytes or 32K words.
The Base Data Space address is used in conjunction
with a Data Space Read or Write Page register
(DSRPAG or DSWPAG) to form an Extended Data
Space (EDS), which has a total address range of
16 Mbytes.
dsPIC33EVXXXGM00X/10X family devices implement
up to 20 Kbytes of data memory (4 Kbytes of data
memory for Special Function Registers and up to
16 Kbytes of data memory for RAM). If an EA points to
a location outside of this area, an all zero word or byte
is returned.
4.2.1DATA SPACE WIDTH
The data memory space is organized in byteaddressable, 16-bit wide blocks. Data is aligned in
data memory and registers as 16-bit words, but all DS
EAs resolve to bytes. The Least Significant Bytes
(LSBs) of each word have even addresses, while the
Most Significant Bytes (MSBs) have odd addresses.
4.2.2DATA MEMORY ORGANIZATION
AND ALIGNMENT
To maintain backward compatibility with PIC
devices and improve Data Space memory usage
efficiency, the dsPIC33EVXXXGM00X/10X family
instruction set supports both word and byte operations.
As a consequence of byte accessibility, all the Effective
Address calculations are internally scaled to step
through word-aligned memory. For example, the core
recognizes that Post-Modified Register Indirect
Addressing mode [Ws++] results in a value of Ws + 1
for byte operations and Ws + 2 for word operations.
A data byte read, reads the complete word that 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 that matches the byte
address.
®
MCU
All word accesses must be aligned to an even address.
Misaligned word data fetches are not supported, therefore, 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 is generated. If the error occurred on a read, the
instruction underway is completed. If the error occurred
on a write, the instruction is executed but the write does
not occur. In either case, a trap is then executed,
allowing the system and/or user application to examine
the machine state prior to execution of the address
Fault.
All byte loads into any W register are loaded into the
LSB; the MSB is not modified.
A Sign-Extend (SE) instruction is provided to allow user
applications to translate 8-bit signed data to 16-bit
signed values. Alternatively, for 16-bit unsigned data,
user applications can clear the MSB of any W register
by executing a Zero-Extend (ZE) instruction on the
appropriate address.
4.2.3SFR SPACE
The first 4 Kbytes of the Near Data Space, from 0x0000
to 0x0FFF, is primarily occupied by Special Function
Registers (SFRs). These are used by the
dsPIC33EVXXXGM00X/10X family 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’.
Note:The actual set of peripheral features and
interrupts varies by the device. Refer to the
corresponding device tables and pinout
diagrams for device-specific information.
4.2.4NEAR DATA SPACE
The 8-Kbyte area, between 0x0000 and 0x1FFF, is
referred to as the Near Data Space. Locations in this
space are directly addressable through a 13-bit absolute address field within all memory direct instructions.
Additionally, the whole DS is addressable using MOV
instructions, which support Memory Direct Addressing
mode with a 16-bit address field, or by using Indirect
Addressing mode using a Working register as an
Address Pointer.
The dsPIC33EVXXXGM00X/10X family core has two
Data Spaces: X and Y. These Data Spaces can be
considered either separate (for some DSP instructions)
or as one unified, linear address range (for MCU
instructions). The Data Spaces are accessed using two
Address Generation Units (AGUs) and separate data
paths. This feature allows certain instructions to
concurrently fetch two words from RAM, thereby
enabling efficient execution of DSP algorithms, such as
Finite Impulse Response (FIR) filtering and Fast
Fourier Transform (FFT).
The X DS is used by all instructions and supports all
addressing modes. The X DS has separate read and
write data buses. The X read data bus is the read data
path for all instructions that view the DS as combined X
and Y address space. It is also the X data prefetch path
for the dual operand DSP instructions (MAC class).
The Y DS is used in concert with the X DS by the MAC
class of instructions (CLR, ED, EDAC, MAC, MOVSAC,MPY, MPY.N and MSC) to provide two concurrent data
read paths.
Both the X and Y Data Spaces support Modulo
Addressing mode for all instructions, subject to
addressing mode restrictions. Bit-Reversed Addressing
mode is only supported for writes to the X Data Space.
All data memory writes, including in DSP instructions,
view Data Space as combined X and Y address space.
The boundary between the X and Y Data Spaces is
device-dependent and is not user-programmable.
DS70005144C-page 38 2013-2014 Microchip Technology Inc.
Note: DS read access when DSRPAG = 0x000 will force an address error trap.
= 1?
DSRPAG<9>
Y
N
Generate
PSV Address
0
4.3.1PAGED MEMORY SCHEME
The dsPIC33EVXXXGM00X/10X family architecture
extends the available DS through a paging scheme,
which allows the available DS to be accessed using
MOV instructions in a linear fashion for pre- and postmodified Effective Addresses (EAs). The upper half of
the Base Data Space address is used in conjunction
with the Data Space Page registers, the 10-bit Data
Space Read Page register (DSRPAG) or the 9-bit Data
The Data Space Page registers are located in the SFR
space. Construction of the EDS address is shown in
Figure 4-7 and Figure 4-8. When DSRPAG<9> = 0 and
the base address bit, EA<15> = 1, the DSRPAG<8:0>
bits are concatenated onto EA<14:0> to form the 24-bit
EDS read address. Similarly, when the base address
bit, EA<15> = 1, the DSWPAG<8:0> bits are
concatenated onto EA<14:0> to form the 24-bit EDS
write address.
Space Write Page register (DSWPAG), to form an EDS
address, or Program Space Visibility (PSV) address.
FIGURE 4-7:EXTENDED DATA SPACE (EDS) READ ADDRESS GENERATION
DS70005144C-page 66 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
1
DSWPAG<8:0>
9 Bits
EA
15 Bits
Byte24-Bit EDS EA
Select
EA
(DSWPAG = Don’t Care)
No EDS Access
Select16-Bit DS EA
Byte
EA<15> = 0
Note: DS read access when DSRPAG = 0x000 will force an address error trap.
Generate
PSV Address
0
EA<15>
FIGURE 4-8:EXTENDED DATA SPACE (EDS) WRITE ADDRESS GENERATION
The paged memory scheme provides access to
multiple 32-Kbyte windows in the EDS and PSV
memory. The Data Space Page registers, DSxPAG, in
combination with the upper half of the Data Space
address, can provide up to 16 Mbytes of additional
address space in the EDS and 8 Mbytes (DSRPAG
only) of PSV address space. The paged data memory
space is shown in Figure 4-9.
The Program Space (PS) can be accessed with a
DSRPAG of 0x200 or greater. Only reads from PS are
supported using the DSRPAG. Writes to PS are not
supported, therefore, the DSWPAG is dedicated to DS,
including EDS. The Data Space and EDS can be read
from and written to using DSRPAG and DSWPAG,
respectively.
DS70005144C-page 67 2013-2014 Microchip Technology Inc.
Allocating different Page registers for read and write
access allows the architecture to support data
movement between different pages in the data
memory. This is accomplished by setting the DSRPAG
register value to the page from which you want to read,
and configure the DSWPAG register to the page to
which it needs to be written. Data can also be moved
from different PSV to EDS pages by configuring the
DSRPAG and DSWPAG registers to address PSV and
EDS space, respectively. The data can be moved
between pages by a single instruction.
When an EDS or PSV page overflow or underflow
occurs, EA<15> is cleared as a result of the register
indirect EA calculation. An overflow or underflow of the
EA in the EDS or PSV pages can occur at the page
boundaries when:
• The initial address, prior to modification,
addresses an EDS or a PSV page.
• The EA calculation uses Pre- or Post-Modified
Register Indirect Addressing. However, this does
not include Register Offset Addressing.
In general, when an overflow is detected, the DSxPAG
register is incremented and the EA<15> bit is set to
keep the base address within the EDS or PSV window.
When an underflow is detected, the DSxPAG register is
decremented and the EA<15> bit is set to keep the
base address within the EDS or PSV window. This
creates a linear EDS and PSV address space, but only
when using the Register Indirect Addressing modes.
Exceptions to the operation described above arise
when entering and exiting the boundaries of Page 0,
EDS and PSV spaces. Ta bl e 4 - 43 lists the effects of
overflow and underflow scenarios at different
boundaries.
In the following cases, when an overflow or underflow
occurs, the EA<15> bit is set and the DSxPAG is not
modified; therefore, the EA will wrap to the beginning of
the current page:
• Register Indirect with Register Offset Addressing
• Modulo Addressing
• Bit-Reversed Addressing
TABLE 4-43:OVERFLOW AND UNDERFLOW SCENARIOS AT PAGE 0, EDS AND
DS
(2,3,4)
Page
Description
Page
Page
Page
Page
DSxPAG
DSRPAG = 0x3001PSV: First MSB
DSRPAG = 0x3FF0See Note 1
DSRPAG = 0x2000See Note 1
DSRPAG = 0x2FF1PSV: Last lsw
DS
EA<15>
Page Description
Page
Page
PSV SPACE BOUNDARIES
O/U,
Operation
R/W
O,
Read
O,
Read
O,
Read
O,
Write
U,
Read
U,
Read
U,
Read
Legend: O = Overflow, U = Underflow, R = Read, W = Write
Note 1:The Register Indirect Addressing now addresses a location in the Base Data Space (0x0000-0x8000).
[++Wn]
or
[Wn++]
[--Wn]
or
[Wn--]
2:An EDS access with DSxPAG = 0x000 will generate an address error trap.
3:Only reads from PS are supported using DSRPAG. An attempt to write to PS using DSWPAG will generate
an address error trap.
4:Pseudolinear Addressing is not supported for large offsets.
DSxPAG
DSRPAG = 0x1FF1EDS: Last PageDSRPAG = 0x1FF0See Note 1
DSRPAG = 0x2FF1PSV: Last lsw
DSRPAG = 0x3FF1PSV: Last MSB
DSWPAG = 0x1FF1EDS: Last PageDSWPAG = 0x1FF0See Note 1
The lower portion of the base address space range,
between 0x0000 and 0x2FFF, is always accessible
regardless of the contents of the Data Space Page
registers; it is indirectly addressable through the
register indirect instructions. It can be regarded as
being located in the default EDS Page 0 (i.e., EDS
address range of 0x000000 to 0x002FFF with the base
address bit, EA<15> = 0, for this address range).
However, Page 0 cannot be accessed through the
upper 32 Kbytes, 0x8000 to 0xFFFF, of Base Data
Space, in combination with DSRPAG = 0x000 or
DSWPAG = 0x000. Consequently, the DSRPAG and
DSWPAG registers are initialized to 0x001 at Reset.
Note 1: DSxPAG should not be used to access
Page 0. An EDS access with DSxPAG
set to 0x000 will generate an address
error trap.
2: Clearing the DSxPAG in software has no
effect.
FIGURE 4-10:EDS MEMORY MAP
The remaining pages, including both EDS and PSV
pages, are only accessible using the DSRPAG or
DSWPAG registers in combination with the upper
32 Kbytes, 0x8000 to 0xFFFF, of the base address,
where the base address bit, EA<15> = 1.
For example, when DSRPAG = 0x001 or
DSWPAG = 0x001, accesses to the upper 32 Kbytes,
0x8000 to 0xFFFF of the Data Space, will map to the
EDS address range of 0x008000 to 0x00FFFF. When
DSRPAG = 0x002 or DSWPAG = 0x002, accesses to
the upper 32 Kbytes of the Data Space will map to the
EDS address range of 0x010000 to 0x017FFF and so
on, as shown in the EDS memory map in Figure 4-10.
For more information on the PSV page access using
Data Space Page registers, refer to Section 4.5
“Program Space Visibility from Data Space” in
“Program Memory” (DS70613) of the “dsPIC33/PIC24
Family Reference Manual”.
DS70005144C-page 70 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
MPLAB® ICD
Reserved
Data Memory Arbiter
M0M1M2M3M4
MSTRPR<15:0>
DMA
CPU
SRAM
4.3.3DATA MEMORY ARBITRATION AND
BUS MASTER PRIORITY
EDS accesses from bus masters in the system are
arbitrated.
The arbiter for data memory (including EDS) arbitrates
between the CPU, the DMA and the MPLAB
module. In the event of coincidental access to a bus by
the bus masters, the arbiter determines which bus
master access has the highest priority. The other bus
masters are suspended and processed after the
access of the bus by the bus master with the highest
priority.
By default, the CPU is Bus Master 0 (M0) with the
highest priority and the MPLAB ICD is Bus Master 4
(M4) with the lowest priority. The remaining bus master
(DMA Controller) is allocated to M3 (M1 and M2 are
reserved and cannot be used). The user application
may raise or lower the priority of the DMA Controller to
be above that of the CPU by setting the appropriate bits
in the EDS Bus Master Priority Control (MSTRPR)
register. All bus masters with raised priorities will
maintain the same priority relationship relative to each
other (i.e., M1 being highest and M3 being lowest, with
M2 in between). Also, all the bus masters with priorities
®
ICD
below that of the CPU maintain the same priority
relationship relative to each other. The priority schemes
for bus masters with different MSTRPR values are
listed in Ta bl e 4 - 44 .
Figure 4-11 shows the arbiter architecture.
The bus master priority control allows the user
application to manipulate the real-time response of the
system, either statically during initialization or
dynamically in response to real-time events.
The W15 register serves as a dedicated Software
Stack Pointer (SSP) and is automatically modified by
exception processing, subroutine calls and returns;
however, W15 can be referenced by any instruction in
the same manner as all other W registers. This simplifies reading, writing and manipulating the SSP (for
example, creating stack frames).
Note:To protect against misaligned stack
accesses, W15<0> is fixed to ‘0’ by the
hardware.
W15 is initialized to 0x1000 during all Resets. This
address ensures that the SSP points to valid RAM in all
dsPIC33EVXXXGM00X/10X family devices and permits stack availability for non-maskable trap exceptions.
These can occur before the SSP is initialized by the user
software. You can reprogram the SSP during initialization to any location within the Data Space.
The SSP always points to the first available free word
and fills the software stack, working from lower toward
higher addresses. Figure 4-12 illustrates how it pre-
decrements for a stack pop (read) and post-increments
for a stack push (writes).
When the PC is pushed onto the stack, PC<15:0> are
pushed onto the first available stack word, then
PC<22:16> are pushed into the second available stack
location. For a PC push during any CALL instruction,
the MSB of the PC is zero-extended before the push,
as shown in Figure 4-12. During exception processing,
the MSB of the PC is concatenated with the lower 8 bits
of the CPU STATUS Register (SR). This allows the
contents of SRL to be preserved automatically during
interrupt processing.
Note 1: To maintain system SSP (W15) coherency,
W15 is never subject to (EDS) paging, and
is therefore, restricted to an address range
of 0x0000 to 0xFFFF. The same applies to
the W14 when used as a Stack Frame
Pointer (SFA = 1).
2: As the stack can be placed in, and can
access X and Y spaces, care must be
taken regarding its use, particularly with
regard to local automatic variables in a
‘C’ development environment.
FIGURE 4-12:CALL STACK FRAME
4.4Instruction Addressing Modes
The addressing modes shown in Table 4-45 form the
basis of the addressing modes optimized to support the
specific features of the individual instructions. The
addressing modes provided in the MAC class of
instructions differ from those in the other instruction types.
4.4.1FILE REGISTER INSTRUCTIONS
Most file register instructions use a 13-bit address field
(f) to directly address data present in the first
8192 bytes of data memory (Near Data Space). Most
file register instructions employ a Working register, W0,
which is denoted as WREG in these instructions. The
destination is typically either the same file register or
WREG (with the exception of the MUL instruction),
which writes the result to a register or register pair. The
MOV instruction allows additional flexibility and can
access the entire Data Space.
4.4.2MCU INSTRUCTIONS
The three-operand MCU instructions are of the form:
Operand 3 = Operand 1 <function> Operand 2
where, Operand 1 is always a Working register (that
is, the addressing mode can only be Register Direct),
which is referred to as Wb. Operand 2 can be a
W register fetched from data memory or a 5-bit literal.
The result location can be either a W register or a data
memory location. The following addressing modes are
supported by MCU instructions:
• Register Direct
• Register Indirect
• Register Indirect Post-Modified
• Register Indirect Pre-Modified
• 5-Bit or 10-Bit Literal
Note:Not all instructions support all of the
addressing modes given above. Individual
instructions can support different subsets
of these addressing modes.
DS70005144C-page 72 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
TABLE 4-45:FUNDAMENTAL ADDRESSING MODES SUPPORTED
Addressing ModeDescription
File Register DirectThe address of the file register is specified explicitly.
Register DirectThe contents of a register are accessed directly.
Register IndirectThe contents of Wn form the Effective Address (EA).
Register Indirect Post-ModifiedThe contents of Wn form the EA. Wn is post-modified (incremented or
decremented) by a constant value.
Register Indirect Pre-ModifiedWn is pre-modified (incremented or decremented) by a signed constant value
to form the EA.
Register Indirect with Register Offset
(Register Indexed)
Register Indirect with Literal OffsetThe sum of Wn and a literal forms the EA.
The sum of Wn and Wb forms the EA.
4.4.3MOVE AND ACCUMULATOR
INSTRUCTIONS
Move instructions and the DSP accumulator class of
instructions provide a greater addressing flexibility than
other instructions. In addition to the addressing modes
supported by most MCU instructions, move and accumulator instructions also support Register Indirect with
Register Offset Addressing mode, also referred to as
Register Indexed mode.
Note:For the MOV instructions, the addressing
mode specified in the instruction can differ
for the source and destination EA. However, the 4-bit Wb (Register Offset) field is
shared by both source and destination
(but typically only used by one).
In summary, the following addressing modes are
supported by move and accumulator instructions:
• Register Direct
• Register Indirect
• Register Indirect Post-Modified
• Register Indirect Pre-Modified
• Register Indirect with Register Offset (Indexed)
• Register Indirect with Literal Offset
• 8-Bit Literal
• 16-Bit Literal
Note:Not all instructions support all the
addressing modes given above. Individual
instructions may support different subsets
of these addressing modes.
4.4.4MAC INSTRUCTIONS
The dual source operand DSP instructions (CLR, ED,EDAC, MAC, MPY, MPY.N, MOVSAC and MSC), also referred
to as MAC instructions, use a simplified set of addressing
modes to allow the user application to effectively
manipulate the Data Pointers through register indirect
tables.
The Two-Source Operand Prefetch registers must be
members of the set, {W8, W9, W10, W11}. For data
reads, W8 and W9 are always directed to the X RAGU,
and W10 and W11 are always directed to the Y AGU.
The Effective Addresses generated (before and after
modification) must, therefore, be valid addresses within
X Data Space for W8 and W9, and Y Data Space for
W10 and W11.
Note:Register Indirect with Register Offset
Addressing mode is available only for W9 (in
X Data Space) and W11 (in Y Data Space).
In summary, the following addressing modes are
supported by the MAC class of instructions:
• Register Indirect
• Register Indirect Post-Modified by 2
• Register Indirect Post-Modified by 4
• Register Indirect Post-Modified by 6
• Register Indirect with Register Offset (Indexed)
4.4.5OTHER INSTRUCTIONS
Besides the addressing modes outlined previously, some
instructions use literal constants of various sizes. For
example, BRA (Branch) instructions use 16-bit signed
literals to specify the Branch destination directly, whereas
the DISI instruction uses a 14-bit unsigned literal field. In
some instructions, such as ULNK, the source of an
operand or result is implied by the opcode itself. Certain
operations, such as a NOP, do not have any operands.
Start Addr = 0x1100
End Addr = 0x1163
Length = 32 Words
Byte
Address
MOV#0x1100, W0
MOVW0, XMODSRT;set modulo start address
MOV#0x1163, W0
MOVW0, MODEND;set modulo end address
MOV#0x8001, W0
MOVW0, MODCON;enable W1, X AGU for modulo
MOV#0x0000, W0;W0 holds buffer fill value
MOV#0x1110, W1;point W1 to buffer
DOAGAIN, #0x31;fill the 50 buffer locations
MOVW0, [W1++];fill the next location
AGAIN: INC W0, W0;increment the fill value
4.5Modulo Addressing
Modulo Addressing mode is a method of providing an
automated means to support circular data buffers using
hardware. The objective is to remove the need for
software to perform data address boundary checks
when executing tightly looped code, as is typical in
many DSP algorithms.
Modulo Addressing can operate in either Data or
Program Space (since the Data Pointer mechanism is
essentially the same for both). One circular buffer can
be supported in each of the X (which also provides the
pointers into Program Space) and Y Data Spaces.
Modulo Addressing can operate on any W Register
Pointer. However, it is not advisable to use W14 or W15
for Modulo Addressing, since these two registers are
used as the SFP and SSP, respectively.
In general, any particular circular buffer can be configured to operate in only one direction, as there are
certain restrictions on the buffer start address (for
incrementing buffers) or end address (for decrementing
buffers), based upon the direction of the buffer.
The only exception to the usage restrictions is for
buffers that have a power-of-two length. As these
buffers satisfy the start and end address criteria, they
can operate in a Bidirectional mode (that is, address
boundary checks are performed on both the lower and
upper address boundaries).
4.5.1START AND END ADDRESS
The Modulo Addressing scheme requires that a
starting and ending address be specified and loaded
into the 16-bit Modulo Buffer Address registers:
XMODSRT, XMODEND, YMODSRT and YMODEND
(see Tabl e 4 -1 ).
Note:Y Data Space Modulo Addressing EA
calculations assume word-sized data
(LSb of every EA is always clear).
The length of a circular buffer is not directly specified. It
is determined by the difference between the corresponding start and end addresses. The maximum
possible length of the circular buffer is 32K words
(64 Kbytes).
4.5.2W ADDRESS REGISTER
SELECTION
The Modulo and Bit-Reversed Addressing Control
register, MODCON<15:0>, contains enable flags, as well
as a W register field to specify the W Address registers.
The XWM and YWM fields select the registers that
operate with Modulo Addressing:
• If XWM = 1111, X RAGU and X WAGU Modulo
Addressing is disabled
• If YWM = 1111, Y AGU Modulo Addressing is
disabled
The X Address Space Pointer W register (XWM) to
which Modulo Addressing is to be applied is stored in
MODCON<3:0> (see Table 4-1). Modulo Addressing is
enabled for X Data Space when XWM is set to any
value other than ‘1111’ and the XMODEN bit
(MODCON<15>) is set
The Y Address Space Pointer W register (YWM) to
which Modulo Addressing is to be applied is stored in
MODCON<7:4>. Modulo Addressing is enabled for Y
Data Space when YWM is set to any value other than
‘1111’ and the YMODEN bit (MODCON<14>) is set.
Figure 4-13 shows an example of Modulo Addressing
operation.
FIGURE 4-13:MODULO ADDRESSING OPERATION EXAMPLE
DS70005144C-page 74 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
4.5.3MODULO ADDRESSING
APPLICABILITY
Modulo Addressing can be applied to the Effective
Address (EA) calculation associated with any W
register. Address boundaries check for addresses
equal to:
• The upper boundary addresses for incrementing
buffers
• The lower boundary addresses for decrementing
buffers
The address boundaries check for addresses less than
or greater than the upper (for incrementing buffers) and
lower (for decrementing buffers) boundary addresses
(not just equal to). Address changes can, therefore,
jump beyond boundaries and still be adjusted correctly.
Note:The modulo corrected Effective Address
is written back to the register only when
Pre-Modify or Post-Modify Addressing
mode is used to compute the Effective
Address. When an address offset, such as
[W7 + W2] is used, Modulo Addressing
correction is performed, but the contents
of the register remain unchanged.
4.6Bit-Reversed Addressing
Bit-Reversed Addressing mode is intended to simplify
data reordering for radix-2 FFT algorithms. It is
supported by the X AGU for data writes only.
The modifier, which can be a constant value or register
contents, is regarded as having its bit order reversed.
The address source and destination are kept in normal
order. Thus, the only operand requiring reversal is the
modifier.
4.6.1BIT-REVERSED ADDRESSING
IMPLEMENTATION
Bit-Reversed Addressing mode is enabled when all of
these conditions are met:
• BWM<3:0> bits (W register selection) in the
MODCON register are any value other than
‘1111’ (the stack cannot be accessed using
Bit-Reversed Addressing)
• The BREN bit is set in the XBREV register
• The addressing mode used is Register Indirect
with Pre-Increment or Post-Increment
If the length of a bit-reversed buffer is M = 2N bytes,
the last ‘N’ bits of the data buffer start address must
be zeros.
XB<14:0> is the Bit-Reversed Addressing modifier, or
‘pivot point’, which is typically a constant. In the case of
an FFT computation, its value is equal to half of the FFT
data buffer size.
Note:All bit-reversed EA calculations assume
word-sized data (LSb of every EA is
always clear). The XB value is scaled
accordingly to generate compatible (byte)
addresses.
When enabled, Bit-Reversed Addressing is executed
only for Register Indirect with Pre-Increment or PostIncrement Addressing and word-sized data writes. It
does not function for any other addressing mode or for
byte-sized data and normal addresses are generated
instead. When Bit-Reversed Addressing is active, the
W Address Pointer is always added to the address
modifier (XB) and the offset associated with the Register Indirect Addressing mode is ignored. In addition, as
word-sized data is a requirement, the LSb of the EA is
ignored (and always clear).
Note:Modulo Addressing and Bit-Reversed
Addressing can be enabled simultaneously
using the same W register, but BitReversed Addressing operation will always
take precedence for data writes when
enabled.
If Bit-Reversed Addressing has already been enabled
by setting the BREN (XBREV<15>) bit, a write to the
XBREV register should not be immediately followed by
an indirect read operation using the W register that has
been designated as the Bit-Reversed Pointer.
The operation of Bit-Reversed Addressing is shown in
DS70005144C-page 76 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
4.7Interfacing Program and Data
Memory Spaces
The dsPIC33EVXXXGM00X/10X family architecture
uses a 24-bit wide Program Space and a 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 the spaces.
Aside from normal execution, the architecture of the
dsPIC33EVXXXGM00X/10X family devices 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 capability
makes the method ideal for accessing data tables that
need to be updated periodically. 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. The application can
only access the least significant word of the program
word.
Table 4-47 shows the construction of the Program
Space address.
How the data is accessed from Program Space is
shown in Figure 4-15.
Note 1:The Least Significant bit (LSb) of Program Space addresses is always fixed as ‘0’ 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.
FIGURE 4-15:DATA ACCESS FROM PROGRAM SPACE ADDRESS GENERATION
DS70005144C-page 78 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
081623
00000000
00000000
00000000
00000000
‘Phantom’ Byte
TBLRDH.B (Wn<0> = 0)
TBLRDL.W
TBLRDL.B (Wn<0> = 1)
TBLRDL.B (Wn<0> = 0)
23150
TBLPAG
02
0x000000
0x800000
0x020000
0x030000
Program Space
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.7.1DATA 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 the 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
wide word address spaces, residing side by side, each
with the same address range. The TBLRDL and
TBLWTL instructions access the space that contains
the least significant data word and 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, this instruction 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, this instruction maps the entire
upper word of a program address (P<23:16>)
to a data address. The ‘phantom’ byte
(D<15:8>) is always ‘0’.
- In Byte mode, this instruction maps the upper
or lower byte of the program word to D<7:0>
of the data address in the TBLRDL instruc-
tion. The data is always ‘0’ when the upper
‘phantom’ byte is selected (Byte Select = 1).
Similarly, 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 Page
register (TBLPAG). TBLPAG covers the entire program
memory space of the device, including user application
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. Accessing the program memory with table
instructions is shown in Figure 4-16.
FIGURE 4-16:ACCESSING PROGRAM MEMORY WITH TABLE INSTRUCTIONS
DS70005144C-page 80 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
0
Program Counter
24 Bits
Program Counter
TBLPAG Reg
8 Bits
Working Reg EA
16 Bits
Byte
24-Bit EA
0
1/0
Select
Using
Table Instruction
Using
User/Configuration
Space Select
5.0FLASH PROGRAM MEMORY
Note 1: This data sheet summarizes the
features of the dsPIC33EVXXXGM00X/
10X family of devices. It is not intended
to be a comprehensive reference
source. To complement the information
in this data sheet, refer to “Flash Pro-
gramming” (DS70609) in the “dsPIC33/
PIC24 Family Reference Manual”, which
is available from the Microchip web site
(www.microchip.com).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
Section 4.0 “Memory Organization” in
this data sheet for device-specific register
and bit information.
The dsPIC33EVXXXGM00X/10X family devices
contain internal Flash program memory for storing and
executing application code. The memory is readable,
writable and erasable during normal operation over the
entire V
The Flash memory can be programmed in the following
three ways:
• In-Circuit Serial Programming™ (ICSP™)
• Run-Time Self-Programming (RTSP)
• Enhanced In-Circuit Serial Programming
ICSP allows for a dsPIC33EVXXXGM00X/10X family
device to be serially programmed while in the end
application circuit. This is done with two lines for
programming clock and programming data (PGECx/
PGEDx) lines, and three other lines for power (V
ground (V
customers to manufacture boards with unprogrammed
DD range.
(Enhanced ICSP)
DD),
SS) and Master Clear (MCLR). This allows
devices and then program the device just before
shipping the product. This also allows the most recent
firmware or a custom firmware to be programmed.
Enhanced ICSP uses an on-board bootloader, known as
the Program Executive (PE), to manage the programming
process. Using an SPI data frame format, the Program
Executive can erase, program and verify program
memory. For more information on Enhanced ICSP, refer
to the specific device programming specification.
RTSP is accomplished using the TBLRD (Table Read)
and TBLWT (Table Write) instructions. With RTSP, the
user application can write program memory data as a
double program memory word, a row of 64 instructions
(192 bytes) and erase program memory in blocks of
512 instruction words (1536 bytes) at a time.
5.1Table Instructions and Flash
Programming
The Flash memory read and the double-word
programming operations make use of the TBLRD and
TBLWT instructions, respectively. These allow direct read
and write access to the program memory space from the
data memory while the device is in normal operating
mode. The 24-bit target address in the program memory
is formed using bits<7:0> of the TBLPAG register and
the Effective Address (EA) from a W register, specified
in the table instruction, as shown in Figure 5-1.
The TBLRDL and the TBLWTL instructions are used to
read or write to bits<15:0> of the program memory.
TBLRDL and TBLWTL can access program memory in
both Word and Byte modes.
The TBLRDH and TBLWTH instructions are used to read
or write to bits<23:16> of the program memory.
TBLRDH and TBLWTH can also access program
memory in Word or Byte mode.
RTSP allows the user application to erase a single
page of memory, program a row and to program two
instruction words at a time. See Ta ble 1 in the
“dsPIC33EVXXXGM00X/10X Product Families”
section for the page sizes of each device.
The Flash program memory array is organized into
rows of 64 instructions or 192 bytes. RTSP allows the
user application to erase a page of program memory,
which consists of eight rows (512 instructions) at a
time, and to program one row or two adjacent words at
a time. The 8-row erase pages and single row write
rows are edge-aligned, from the beginning of program
memory, on boundaries of 1536 bytes and 192 bytes,
respectively. Table 30-13inSection 30.0 “Electrical
Characteristics” lists the typical erase and
programming times.
The basic sequence for RTSP word programming is to
use the TBLWTL and TBLWTH instructions to load two of
the 24-bit instructions into the write latches found in
configuration memory space. See Figure 4-1 to
Figure 4-4 for write latch addresses. Programming is
performed by unlocking and setting the control bits in
the NVMCON register.
Row programming is performed by loading 192 bytes
into data memory and then loading the address of the
first byte in that row into the NVMSRCADR register.
Once the write has been initiated, the device will automatically load the write latches and increment the
NVMSRCADR and the NVMADR(U) registers until all
bytes have been programmed. The RPDF bit
(NVMCON<9>) selects the format of the stored data in
RAM to be either compressed or uncompressed. See
Figure 5-2 for data formatting. Compressed data helps
to reduce the amount of required RAM by using the
upper byte of the second word for the MSB of the second
instruction.
For more information on erasing and programming the
Flash memory, refer to “Flash Programming”
(DS70609) in the “dsPIC33/PIC24 Family ReferenceManual”.
Note 1: Before reprogramming either of the two
2: Before reprogramming any word in a row,
words in a double-word pair, the user
must erase the Flash memory page in
which it is located.
the user must erase the Flash memory
page in which it is located.
FIGURE 5-2:UNCOMPRESSED/
COMPRESSED FORMAT
5.3Programming Operations
A complete programming sequence is necessary for
programming or erasing the internal Flash in RTSP
mode. The processor stalls (waits) until the programming operation is finished. Setting the WR bit
(NVMCON<15>) starts the operation and the WR bit is
automatically cleared when the operation is finished.
5.3.1PROGRAMMING ALGORITHM FOR
FLASH PROGRAM MEMORY
Programmers can program two adjacent words
(24 bits x 2) of program Flash memory at a time on
every other word address boundary (0x000002,
0x000006, 0x00000A, etc.). To do this, erase the page
that contains the desired address of the location the
user wants to change. For protection against accidental
operations, the write initiate sequence for NVMKEY
must be used to allow any erase or program operation
to proceed. After the programming command has been
executed, the user application must wait for the programming time until programming is complete. The two
instructions following the start of the programming
sequence should be NOPs.
Refer to “Flash Programming” (DS70609) in the
“dsPIC33/PIC24 Family Reference Manual” for details
and code examples on programming using RTSP.
DS70005144C-page 82 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
5.4Error Correcting Code (ECC)
In order to improve program memory performance and
durability, these devices include Error Correcting Code
functionality (ECC) as an integral part of the Flash
memory controller. ECC can determine the presence of
single-bit errors in program data, including which bit is
in error, and correct the data automatically without user
intervention. ECC cannot be disabled.
When data is written to program memory, ECC
generates a 7-bit Hamming code parity value for every
two (24-bit) instruction words. The data is stored in
blocks of 48 data bits and 7 parity bits; parity data is not
memory-mapped and is inaccessible. When the data is
read back, the ECC calculates the parity on it and
compares it to the previously stored parity value. If a
parity mismatch occurs, there are two possible
outcomes:
• Single-bit errors are automatically identified and
corrected on read-back. An optional device-level
interrupt (ECCSBEIF) is also generated.
• Double-bit errors will generate a generic hard trap
and the read data is not changed. If special
exception handling for the trap is not
implemented, a device Reset will also occur.
To use the single-bit error interrupt, set the ECC SingleBit Error Interrupt Enable bit (ECCSBEIE) and
configure the ECCSBEIP bits to set the appropriate
interrupt priority.
Except for the single-bit error interrupt, error events are
not captured or counted by hardware. This functionality
can be implemented in the software application, but it
is the user’s responsibility to do so.
5.5Flash Memory Resources
Many useful resources are provided on the main
product page of the Microchip web site for the devices
listed in this data sheet. This product page contains the
latest updates and additional information.
5.5.1KEY RESOURCES
• Code Samples
• Application Notes
• Software Libraries
• Webinars
• All Related “dsPIC33/PIC24 Family Reference Manual” Sections
• Development Tools
5.6Control Registers
The following five SFRs are used to read and write the
program Flash memory: NVMCON, NVMKEY,
NVMADR, NVMADRU and NVMSRCADR.
The NVMCON register (Register 5-1) selects the
operation to be performed (page erase, word/row
program, inactive panel erase) and initiates the
program/erase cycle.
NVMKEY (Register 5-4) is a write-only register that is
used for write protection. To start a programming or
erase sequence, the user application must
consecutively write 0x55 and 0xAA to the NVMKEY
register.
There are two NVM Address registers: NVMADRU and
NVMADR. These two registers, when concatenated,
form the 24-bit Effective Address (EA) of the selected
word/row for programming operations or the selected
page for erase operations. The NVMADRU register is
used to hold the upper 8 bits of the EA, while the
NVMADR register is used to hold the lower 16 bits of
the EA. For row programming operation, data to be
written to program Flash memory is written into data
memory space (RAM) at an address defined by the
NVMSRCADR register (location of the first element in
row programming data).
REGISTER 5-1:NVMCON: NONVOLATILE MEMORY (NVM) CONTROL REGISTER
R/SO-0R/W-0R/W-0R/W-0U-0U-0R/W-0R/W-0
(1)
WR
bit 15bit 8
U-0U-0U-0U-0R/W-0R/W-0R/W-0R/W-0
————NVMOP3
bit 7bit 0
Legend:SO = Settable Only bit
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
WREN
(1)
WRERR
(1)
NVMSIDL
(2)
——RPDFURERR
(1,3,4)
NVMOP2
(1,3,4)
NVMOP1
(1,3,4)
NVMOP0
(1,3,4)
bit 15WR: Write Control bit
(1)
1 = Initiates a Flash memory program or erase operation; the operation is self-timed and the bit is
cleared by hardware once the operation is complete
0 = Program or erase operation is complete and inactive
bit 14WREN: Write Enable bit
(1)
1 = Flash program or erase operations are enabled
0 = Flash program or erase operations are inhibited
bit 13WRERR: Write Sequence Error Flag bit
(1)
1 = An improper program or erase sequence attempt, or termination has occurred (bit is set automatically
on any set attempt of the WR bit)
0 = The program or erase operation completed normally
bit 12NVMSIDL: NVM Stop in Idle Control bit
(2)
1 = Primary Flash operation discontinues when the device enters Idle mode
0 = Primary Flash operation continues when the device enters Idle mode.
bit 11-10Unimplemented: Read as ‘0’
bit 9RPDF: Row Programming Data Format Control bit
1 = Row data to be stored in RAM is in a compressed format
0 = Row data to be stored in RAM is in an uncompressed format
bit 8URERR: Row Programming Data Underrun Error Flag bit
1 = Row programming operation has been terminated due to a data underrun error
0 = No data underrun has occurred
bit 7-4Unimplemented: Read as ‘0’
Note 1:These bits can only be reset on a POR.
2: If this bit is set, there will be minimal power savings (I
VREG) before Flash memory becomes operational.
(T
IDLE), and upon exiting Idle mode, there is a delay
3: All other combinations of NVMOP<3:0> are unimplemented.
4: Execution of the PWRSAV instruction is ignored while any of the NVM operations are in progress.
5: Two adjacent words on a 4-word boundary are programmed during execution of this operation.
DS70005144C-page 84 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
REGISTER 5-1:NVMCON: NONVOLATILE MEMORY (NVM) CONTROL REGISTER (CONTINUED)
2: If this bit is set, there will be minimal power savings (IIDLE), and upon exiting Idle mode, there is a delay
VREG) before Flash memory becomes operational.
(T
3: All other combinations of NVMOP<3:0> are unimplemented.
4: Execution of the PWRSAV instruction is ignored while any of the NVM operations are in progress.
5: Two adjacent words on a 4-word boundary are programmed during execution of this operation.
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 15-0NVMADR<15:0>: NVM Memory Lower Write Address bits
Selects the lower 16 bits of the location to program or erase in program Flash memory. This register
may be read or written to by the user application.
DS70005144C-page 88 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
6.0RESETS
Note 1: This data sheet summarizes the features
of the dsPIC33EVXXXGM00X/10X family
of devices. It is not intended to be a
comprehensive reference source. To complement the information in this data sheet,
refer to “Reset” (DS70602) in the
“dsPIC33/PIC24 Family Reference Manual”, which is available from the Microchip
web site (www.microchip.com).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
Section 4.0 “Memory Organization” in
this data sheet for device-specific register
and bit information.
The Reset module combines all Reset sources and
controls the device Master Reset Signal, SYSRST
following is a list of device Reset sources:
• POR: Power-on Reset
• BOR: Brown-out Reset
•MCLR
•SWR: RESET Instruction
• WDTO: Watchdog Timer Time-out Reset
• CM: Configuration Mismatch Reset
• TRAPR: Trap Conflict Reset
• IOPUWR: Illegal Condition Device Reset
: Master Clear Pin Reset
- Illegal Opcode Reset
- Uninitialized W Register Reset
- Security Reset
- Illegal Address Mode Reset
. The
A simplified block diagram of the Reset module is
shown in Figure 6-1.
Any active source of Reset will make the SYSRST
signal active. On system Reset, some of the registers
associated with the CPU and peripherals are forced to
a known Reset state and some are unaffected.
Note:Refer to the specific peripheral section or
Section 4.0 “Memory Organization” of
this device data sheet for register Reset
states.
All types of device Reset set a corresponding status bit
in the RCON register to indicate the type of Reset (see
Register 6-1).
A POR clears all the bits, except for the POR and BOR
bits (RCON<1:0>) that are set. The user application
can set or clear any bit at any time during code
execution. The RCON bits only serve as status bits.
Setting a particular Reset status bit in software does
not cause a device Reset to occur.
The RCON register also has other bits associated with
the Watchdog Timer and device power-saving states.
The function of these bits is discussed in the other
sections of this device data sheet.
Note:The status bits in the RCON register
should be cleared after they are read.
Therefore, the next RCON register value
after a device Reset is meaningful.
Note:In all types of Resets, to select the device
clock source, the contents of OSCCON are
initialized from the FNOSCx Configuration
bits in the FOSCSEL Configuration register.
1 = Device has been in Sleep mode
0 = Device has not been in Sleep mode
bit 2IDLE: Wake-up from Idle Flag bit
1 = Device was in Idle mode
0 = Device was not in Idle mode
bit 1BOR: Brown-out Reset Flag bit
1 = A Brown-out Reset has occurred
0 = A Brown-out Reset has not occurred
bit 0POR: Power-on Reset Flag bit
1 = A Power-on Reset has occurred
0 = A Power-on Reset has not occurred
Note 1:All of the Reset status bits can be set or cleared in software. Setting one of these bits in software does not
cause a device Reset.
2:If the FWDTEN<1:0> Configuration bits are ‘11’ (unprogrammed), the WDT is always enabled, regardless
of the SWDTEN bit setting.
(1)
(CONTINUED)
DS70005144C-page 92 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
7.0INTERRUPT CONTROLLER
Note 1: This data sheet summarizes the features
of the dsPIC33EVXXXGM00X/10X
family of devices. It is not intended to be
a comprehensive reference source. To
complement the information in this
data sheet, refer to “Interrupts”
(DS70000600) in the “dsPIC33/PIC24Family Reference Manual”, which is
available from the Microchip web site
(www.microchip.com).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
Section 4.0 “Memory Organization” in
this data sheet for device-specific register
and bit information.
The dsPIC33EVXXXGM00X/10X family interrupt controller reduces the numerous peripheral interrupt
request signals to a single interrupt request signal to
the dsPIC33EVXXXGM00X/10X CPU. The Interrupt
Vector Table (IVT) provides 246 interrupt sources
(unused sources are reserved for future use) that can
be programmed with different priority levels.
The interrupt controller has the following features:
• Interrupt Vector Table with up to 246 Vectors
• Alternate Interrupt Vector Table (AIVT)
• Up to Eight Processor Exceptions and Software
Traps
• Seven User-Selectable Priority Levels
• Interrupt Vector Table (IVT) with a Unique Vector
for Each Interrupt or Exception Source
• Fixed Priority within a Specified User Priority Level
• Fixed Interrupt Entry and Return Latencies
• Software can Generate any Peripheral Interrupt
• Alternate Interrupt Vector Table (AIVT) if Boot
Security is Enabled and AIVTEN = 1
7.1Interrupt Vector Table
The dsPIC33EVXXXGM00X/10X family IVT, shown
in Figure 7-2, resides in program memory, starting at
location, 000004h. The IVT contains seven nonmaskable trap vectors and up to 187 sources of
interrupt. In general, each interrupt source has its own
vector. Each interrupt vector contains a 24-bit wide
address. The value programmed into each interrupt
vector location is the starting address of the associated
Interrupt Service Routine (ISR).
Interrupt vectors are prioritized in terms of their natural
priority. This priority is linked to their position in the
vector table. Lower addresses generally have a higher
natural priority. For example, the interrupt associated
with Vector 0 takes priority over interrupts at any other
vector address.
7.2Alternate Interrupt Vector Table
The Alternate Interrupt Vector Table (AIVT), shown in
Figure 7-1, is available if the Boot Segment (BS) is
defined, the AIVTEN bit is set in the INTCON2 register
and if the AIVTDIS Configuration bit is set to ‘1’. The
AIVT begins at the start of the last page of the Boot
Segment.
A device Reset is not a true exception because the
interrupt controller is not involved in the Reset process.
The dsPIC33EVXXXGM00X/10X family devices clear
their registers in response to a Reset, which forces the
PC to zero. The device then begins program execution
at location, 0x000000. A GOTO instruction at the Reset
address can redirect program execution to the
appropriate start-up routine.
Note:Any unimplemented or unused vector
locations in the IVT should be programmed with the address of a default
interrupt handler routine that contains a
RESET instruction.
7.4Interrupt Control and Status
Registers
dsPIC33EVXXXGM00X/10X family devices implement
the following registers for the interrupt controller:
• INTCON1
• INTCON2
• INTCON3
• INTCON4
•IFSx
•IECx
•IPCx
•INTTREG
7.4.1INTCON1 THROUGH INTCON4
Global interrupt control functions are controlled from
the INTCON1, INTCON2, INTCON3 and INTCON4
registers.
INTCON1 contains the Interrupt Nesting Disable bit
(NSTDIS), as well as the control and status flags for the
processor trap sources.
The INTCON2 register controls external interrupt
request signal behavior and also contains the Global
Interrupt Enable bit (GIE).
INTCON3 contains the status flags for the DMT (Deadman Timer), DMA and DO stack overflow status trap
sources.
The INTCON4 register contains the ECC Double-Bit
Error (ECCDBE) and Software Generated Hard Trap
(SGHT) status bit.
7.4.3IECx
The IECx registers maintain all of the interrupt enable
bits. These control bits are used to individually enable
interrupts from the peripherals or external signals.
7.4.4IPCx
The IPCx registers are used to set the Interrupt Priority
Level (IPL) for each source of interrupt. Each user
interrupt source can be assigned to one of eight priority
levels.
7.4.5INTTREG
The INTTREG register contains the associated
interrupt vector number and the new CPU Interrupt
Priority Level, which are latched into Vector Number
(VECNUM<7:0>) and Interrupt Priority Level bit
(ILR<3:0>) fields in the INTTREG register. The new
Interrupt Priority Level is the priority of the pending
interrupt.
The interrupt sources are assigned to the IFSx, IECx
and IPCx registers in the same sequence as they are
listed in Table 7-1. For example, the INT0 (External
Interrupt 0) is shown as having Vector Number 8 and a
natural order priority of 0. Thus, the INT0IF bit is found
in IFS0<0>, the INT0IE bit in IEC0<0> and the INT0IP
bits in the first position of IPC0 (IPC0<2:0>).
7.4.6STATUS/CONTROL REGISTERS
Although these registers are not specifically part of the
interrupt control hardware, two of the CPU Control
registers contain bits that control interrupt functionality.
For more information on these registers, refer to
“CPU” (DS70359) in the “dsPIC33/PIC24 Family
Reference Manual”.
• The CPU STATUS Register, SR, contains the
IPL<2:0> bits (SR<7:5>). These bits indicate the
current CPU Interrupt Priority Level. The user
software can change the current CPU Interrupt
Priority Level by writing to the IPLx bits.
• The CORCON register contains the IPL3 bit
which, together with IPL<2:0>, also indicates the
current CPU Interrupt Priority Level. IPL3 is a
read-only bit so that trap events cannot be
masked by the user software.
All Interrupt registers are described in Register 7-3 to
Register 7-7.
7.4.2IFSx
The IFSx registers maintain all of the interrupt request
flags. Each source of interrupt has a status bit, which is
set by the respective peripherals or external signal and
is cleared through software.
DS70005144C-page 98 2013-2014 Microchip Technology Inc.
dsPIC33EVXXXGM00X/10X FAMILY
REGISTER 7-1:SR: CPU STATUS REGISTER
R/W-0R/W-0R/W-0R/W-0R/C-0R/C-0R-0R/W-0
OAOBSASBOABSABDADC
bit 15bit 8
R/W-0R/W-0R/W-0R-0R/W-0R/W-0R/W-0R/W-0
(2,3)
IPL2
bit 7bit 0
Legend:C = Clearable bit
R = Readable bitW = Writable bitU = Unimplemented bit, read as ‘0’
-n = Value at POR‘1’ = Bit is set‘0’ = Bit is clearedx = Bit is unknown
bit 7-5IPL<2:0>: CPU Interrupt Priority Level Status bits
(2,3)
IPL1
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)
IPL0
(2,3)
(1)
RANOVZC
(2,3)
Note 1:For complete register details, see Register 3-1.
2:The IPL<2:0> bits are concatenated with the IPL3 bit (CORCON<3>) to form the CPU Interrupt Priority
Level. The value in parentheses indicates the IPL if IPL3 = 1. User interrupts are disabled when IPL3 = 1.
3:The IPL<2:0> Status bits are read-only when the NSTDIS bit (INTCON1<15>) = 1.