dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X AND
PIC24EPXXXGP/MC20X PRODUCT
FAMILIES
The device names, pin counts, memory sizes and
peripheral availability of each device are listed in
Table 1 (General Purpose Families) and Table 2 (Motor
Control Families). Their pinout diagrams appear on the
following pages.
T A BL E 1:dsPIC33EPXXXGP50X a nd PIC24 EPX XXGP 20X GEN ERAL PUR POSE FA MILIE S
Remappable Peripherals
(3)
Device
RAM (Kbyte)
Page Erase Size (Instructions)
Program Flash Memor y (Kbytes)
PIC24EP32GP202512324
PIC24EP64GP2021024 648
PIC24EP128GP2021024 12816
PIC24EP256GP2021024 25632
PIC24EP512GP2021024 51248
PIC24EP32GP203512324
PIC24EP64GP2031024 648
PIC24EP32GP204512324
PIC24EP64GP2041024 648
PIC24EP128GP2041024 12816
PIC24EP256GP2041024 25632
PIC24EP512GP2041024 51248
PIC24EP64GP2061024 648
PIC24EP128GP2061024 12816
PIC24EP256GP2061024 25632
PIC24EP512GP2061024 51248
dsPIC33EP32GP502512324
dsPIC33EP64GP5021024 648
dsPIC33EP128GP502 1024 12816
dsPIC33EP256GP502 1024 25632
dsPIC33EP512GP502 1024 51248
dsPIC33EP32GP503512324
dsPIC33EP64GP5031024 648
dsPIC33EP32GP504512324
dsPIC33EP64GP5041024 648
dsPIC33EP128GP504 1024 12816
dsPIC33EP256GP504 1024 25632
dsPIC33EP512GP504 1024 51248
dsPIC33EP64GP5061024 648
dsPIC33EP128GP506 1024 12816
dsPIC33EP256GP506 1024 25632
dsPIC33EP512GP506 1024 51248
Note 1:On 28-pin devices, Comparator 4 does not have external connections. Refer to Section 25.0 “Op Amp/Comparator Module” for details.
2:Only SPI2 is remappable.
3:INT0 is not remappable.
4:The SSOP and VTLA packages are not available for devices with 512 Kbytes of memory.
Input Capture
16-Bit/32-Bit Timers
54422—32162/3
54422—32183/4YesYes2536VTLA
54422—32193/4YesYes35
54422—321163/4YesYes5364
54422132162/3
54422132183/4YesYes2536VTLA
54422132193/4YesYes35
544221321163/4YesYes5364
Output Compare
UART
(2)
SPI
C™
2
I
CRC Generator
ECAN™ Technology
External Interrupts
Op Am ps/Com parators
10-Bit/12-Bit ADC (Channels)
(1)
(1)
PTG
CTMU
Yes Yes 2128
Yes Yes 2128
I/O Pins
44/
44/
Pins
Packages
SPDIP,
SOIC,
SSOP
QFN-S
VTLA
TQFP,
QFN,
48
UQFN
TQFP,
QFN
SPDIP,
SOIC,
SSOP
QFN-S
VTLA
TQFP,
QFN,
48
UQFN
TQFP,
QFN
(4)
,
(4)
,
(4)
,
(4)
,
DS70000657H-page 2 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
TABLE 2:dsPI C3 3E PXXX MC20 X/ 50 X and PIC 24 EPX XXMC2 0X MOTOR C ONTR OL
FAMILIES
Remappable Peripherals
Device
(4)
(2)
SPI
RAM (Kbytes)
Input Capture
16-Bit/32-Bit Timers
Page Erase Size (Instructions)
Program Flash Memory (Kbytes)
(Channels)
Output Compare
Motor Control PWM
UART
Quadrature Encoder Interface
(3)
C™
2
I
PTG
CTMU
Pins
I/O Pins
CRC Generator
ECAN™ Technology
External Interrupts
Op Amps/Comparators
10-Bit/12-Bit ADC (Channels)
PIC24EP32MC202512 324
PIC24EP64MC2021024 648
PIC24EP128MC2021024 128 16
PIC24EP256MC2021024 256 32
544 6 122—32162/3
(1)
Yes Yes 21 28
SPDIP,
SOIC,
SSOP
QFN-S
PIC24EP512MC2021024 512 48
PIC24EP32MC203512 324
PIC24EP64MC2031024 648
544 6 122—32183/4YesYes2536VTLA
PIC24EP32MC204512 324
PIC24EP64MC2041024 648
PIC24EP128MC2041024 128 16
PIC24EP256MC2041024 256 32
544 6 122—32193/4YesYes35
44/
48
VTLA
TQFP,
QFN,
UQFN
PIC24EP512MC2041024 512 48
PIC24EP64MC2061024 648
PIC24EP128MC2061024 128 16
PIC24EP256MC2061024 256 32
544 6 122—321163/4YesYes5364
TQFP,
QFN
PIC24EP512MC2061024 512 48
dsPIC33EP32MC202512 324
dsPIC33EP64MC2021024 648
dsPIC33EP128MC202 1024 128 16
dsPIC33EP256MC202 1024 256 32
544 6 122—32162/3
(1)
Yes Yes 21 28
SPDIP,
SOIC,
SSOP
QFN-S
dsPIC33EP512MC202 1024 512 48
dsPIC33EP32MC203512 324
dsPIC33EP64MC2031024 648
544 6 122—32183/4YesYes2536VTLA
dsPIC33EP32MC204512 324
dsPIC33EP64MC2041024 648
dsPIC33EP128MC204 1024 128 16
dsPIC33EP256MC204 1024 256 32
544 6 122—32193/4YesYes35
44/
48
VTLA
TQFP,
QFN,
UQFN
dsPIC33EP512MC204 1024 512 48
dsPIC33EP64MC2061024 648
dsPIC33EP128MC206 1024 128 16
dsPIC33EP256MC206 1024 256 32
544 6 122—321163/4YesYes5364
TQFP,
QFN
dsPIC33EP512MC206 1024 512 48
dsPIC33EP32MC502512 324
dsPIC33EP64MC5021024 648
dsPIC33EP128MC502 1024 128 16
dsPIC33EP256MC502 1024 256 32
544 6 122132162/3
(1)
Yes Yes 21 28
SPDIP,
SOIC,
SSOP
QFN-S
dsPIC33EP512MC502 1024 512 48
dsPIC33EP32MC503512 324
dsPIC33EP64MC5031024 648
544 6 122132183/4YesYes2536VTLA
Note 1:On 28-pin devices, Comparator 4 does not have external connections. Refer to Section 25.0 “Op Amp/Comparator Module” for details.
2:Only SPI2 is remappable.
3:INT0 is not remappable.
4:Only the PWM Faults are remappable.
5:The SSOP and VTLA packages are not available for devices with 512 Kbytes of memory.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
T ABLE 2:dsPIC33E PXXX MC 20 X/50 X and PI C24 EPX XXM C2 0X MOTOR CO NTROL
FAMILIES (CONTINUED)
Remappable Peripheral s
(4)
Device
RAM (Kbytes)
Page Erase Size (Instructions)
Program Flash Memory (Kbytes)
dsPIC33EP32MC504512 324
dsPIC33EP64MC5041024 648
dsPIC33EP128MC504 1024 128 16
dsPIC33EP256MC504 1024 256 32
dsPIC33EP512MC504 1024 512 48
dsPIC33EP64MC5061024 648
dsPIC33EP128MC506 1024 128 16
dsPIC33EP256MC506 1024 256 32
dsPIC33EP512MC506 1024 512 48
Note 1:On 28-pin devices, Comparator 4 does not have external connections. Refer to Section 25.0 “Op Amp/Comparator Module” for details.
2:Only SPI2 is remappable.
3:INT0 is not remappable.
4:Only the PWM Faults are remappable.
5:The SSOP and VTLA packages are not available for devices with 512 Kbytes of memory.
Input Capture
16-Bit/32-Bit Timers
544 6 122132193/4YesYes35
544 6 1221321163/4YesYes5364
(Channels)
Output Compare
Motor Control PWM
Quadrature Encoder Interface
UART
(2)
SPI
(3)
C™
2
I
CRC Generator
ECAN™ Technology
External Interrupts
Op Amps/Comparators
10-Bit/12-Bit ADC (Channels)
PTG
CTMU
Pins
I/O Pins
VTLA
44/
TQFP,
48
QFN,
UQFN
TQFP,
QFN
Packages
(5)
,
DS70000657H-page 4 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
28-Pin SPDIP/SOIC/SSOP
(1,2)
Note 1:The RPn/RPIn pins can be used by any remappable peripheral with some limitation. See Section 11.4
“Peripheral Pin Sele ct (PPS )” for available peripherals and for information on limitations.
2:Every I/O port pin (RAx-RGx) can be used as a Change Notification pin (CNAx-CNGx). See Section 11.0 “I/O
Ports” for more information.
3:There is an internal pull-up resistor connected to the TMS pin when the JTAG interface is active. See the
Note 1:The RPn/RPIn pins can be used by any remappable peripheral with some limitation. See Section 11.4
“Peripheral Pin Select (PPS)” for available peripherals and for information on limitations.
2:Every I/O port pin (RAx-RGx) can be used as a Change Notification pin (CNAx-CNGx). See Section 11.0 “I/O
Ports” for more information.
3:This pin is not available as an input when OPMODE (CMxCON<10>) = 1.
4:The metal pad at the bottom of the device is not connected to any pins and is recommended to be connected
to V
SS externally.
5:There is an internal pull-up resistor connected to the TMS pin when the JTAG interface is active. See the
Note 1:The RPn/RPIn pins can be used by any remappable peripheral with some limitation. See Section 11.4
“Peripheral Pin Select (PPS)” for available peripherals and for information on limitations.
2:Every I/O port pin (RAx-RGx) can be used as a Change Notification pin (CNAx-CNGx). See Section 11.0 “I/ O
Ports” for more information.
3:This pin is not available as an input when OPMODE (CMxCON<10>) = 1.
4:The metal pad at the bottom of the device is not connected to any pins and is recommended to be connected
to V
SS externally.
5:There is an internal pull-up resistor connected to the TMS pin when the JTAG interface is active. See the
2.0Guidelines for Getting Started with 16-bit Digital Signal Controllers and Microcontrollers ......................................................... 29
5.0Flash Program Memory ............................................................................................................................................................ 119
10.0 Power-Saving Features ............................................................................................................................................................ 163
21.0 Enhanced CAN (ECAN™) Module (dsPIC33EPXXXGP/MC50X Devices Only) ..................................................................... 287
22.0 Charge Time Measurement Unit (CTMU) ............................................................................................................................... 315
27.0 Special Features ...................................................................................................................................................................... 379
28.0 Instruction Set Summary .......................................................................................................................................................... 387
29.0 Development Support............................................................................................................................................................... 397
32.0 DC and AC Device Characteristics Graphs.............................................................................................................................. 475
Index ................................................................................................................................................................................................. 517
The Microchip Web Site..................................................................................................................................................................... 525
Customer Change Notification Service .............................................................................................................................................. 525
Customer Support .............................................................................................................................................................................. 525
DS70000657H-page 22 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
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.
DS70000657H-page 24 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
PORTA
Power-up
Timer
Oscillator
Star t-up
OSC1/CLKI
MCLR
VDD, VSS
UART1,
Timing
Generation
ECAN1
(2)
I2C1,
ADC
Timers
Input
Capture
Output
Compare
AV
DD, AVSS
UART2
SPI2
SPI1,
Watchdog
Timer
POR/BOR
CRC
I2C2
QEI1
(1)
PWM
(1)
Remappable
Pins
Note 1:This feature or peripheral is only available on dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X devices.
2:This feature or peripheral is only available on dsPIC33EPXXXGP/MC50X devices.
Op Amp/
Comparator
CTMU
PTG
CPU
Refer to Figure 3-1 for CPU diagram details.
16
16
PORTB
PORTC
PORTD
PORTE
PORTF
PORTG
PORTS
Peripheral Modules
Timer
1.0DEVICE OVERVIEW
This document contains device-specific information for
the dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/
Note 1: This data sheet summarizes the
features of the dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X and
PIC24EPXXXGP/MC20X families of
devices. It is not intended to be a comprehensive resource. To complement
the information in this data sheet, refer
to the related section of the “dsPIC33/PIC24 Family Reference Manual”,
which is available from the Microchip
50X and PIC24EPXXXGP/MC20X Digital Signal
Controller (DSC) and Microcontroller (MCU) devices.
dsPIC33EPXXXMC20X/50X and dsPIC33EPXXXGP50X
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:dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
Note 1:This pin is available on dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X devices only.
2:This pin is available on dsPIC33EPXXXGP/MC50X devices only.
3:This is the default Fault on Reset for dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X devices. See
Section 16.0 “High-Speed PWM Module (dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X
Devices Only)” for more information.
4:Not all pins are available in all packages variants. See the “Pin Diagrams” section for pin availability.
5:There is an internal pull-up resistor connected to the TMS pin when the JTAG interface is active. See the
JTAGEN bit field in Table 27-2.
Type
I
I/O
I
I
O
I
I
I
I
I
I
I
I
O
I
I
I
O
I
O
O
Buffer
Type
CMOS
ST/
CMOS
—
ST
ST
—
ST
ST
ST
ST
ST
ST
ST
ST
ST
ST
ST
ST
—
ST
—
ST
PPSDescription
No External clock source input. Always associated with OSC1 pin function.
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.
Yes
Compare Fault A input (for Compare channels).
No
Compare Fault B input (for Compare channels).
Yes
Compare Outputs 1 through 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.
No
UART1 Clear-To-Send.
No
UART1 Ready-To-Send.
Yes
UART1 receive.
Yes
UART1 transmit.
No
UART1 IrDA
®
baud clock output.
DS70000657H-page 26 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
Synchronous serial clock input/output for SPI1.
SPI1 data in.
SPI1 data out.
SPI1 slave synchronization or frame pulse I/O.
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.
Synchronous serial clock input/output for I2C2.
Synchronous serial data input/output for I2C2.
Alternate synchronous serial clock input/output for I2C2.
Alternate synchronous serial data input/output for I2C2.
JTAG Test mode select pin.
JTAG test clock input pin.
JTAG test data input pin.
JTAG test data output pin.
ECAN1 bus receive pin.
ECAN1 bus transmit pin.
PWM Fault Inputs 1 and 2.
PWM Fault Inputs 3 and 4.
PWM Fault Input 32 (Class B Fault).
PWM Dead-Time Compensation Inputs 1 through 3.
PWM Low Outputs 1 through 3.
PWM High Outputs 1 through 3.
PWM Synchronization Input 1.
PWM Synchronization Output 1.
Quadrature Encoder Index1 pulse input.
Quadrature Encoder Home1 pulse input.
Quadrature Encoder Phase A input in QEI1 mode. Auxiliary timer
external clock/gate input in Timer mode.
Quadrature Encoder Phase B input in QEI1 mode. Auxiliary timer
external clock/gate input in Timer mode.
Quadrature Encoder Compare Output 1.
Legend: CMOS = CMOS compatible input or outputAnalog = Analog inputP = Power
Note 1:This pin is available on dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X devices only.
2:This pin is available on dsPIC33EPXXXGP/MC50X devices only.
3:This is the default Fault on Reset for dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X devices. See
Section 16.0 “High-Speed PWM Module (dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X
Devices Only)” for more information.
4:Not all pins are available in all packages variants. See the “Pin Diagrams” section for pin availability.
5:There is an internal pull-up resistor connected to the TMS pin when the JTAG interface is active. See the
Note 1:This pin is available on dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X devices only.
2:This pin is available on dsPIC33EPXXXGP/MC50X devices only.
3:This is the default Fault on Reset for dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X devices. See
Section 16.0 “High-Speed PWM Module (dsPIC33EPXXXMC20X/50X and PIC24EPXXXMC20X
Devices Only)” for more information.
4:Not all pins are available in all packages variants. See the “Pin Diagrams” section for pin availability.
5:There is an internal pull-up resistor connected to the TMS pin when the JTAG interface is active. See the
JTAGEN bit field in Table 27-2.
DS70000657H-page 28 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
2.0GUIDELINES FOR GETTING
STARTED WITH 16-BIT
DIGITAL SIGNAL
CONTROLLERS AND
MICROCONTROLLERS
Note 1: This data sheet summarizes the
features of the dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X and
PIC24EPXXXGP/MC20X families 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 of 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.
2.1Basic ConnectionRequirements
Getting started with the dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X and
PIC24EPXXXGP/MC20X families 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
Additionally, the following pins may be required:
•V
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 (V
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”)
REF+/VREF- pins are used when external voltage
reference for the ADC module is implemented
Note:The AV
CAP)”)
DD and AVSS pins must be
connected, independent of the ADC
voltage reference source.
2.2DecouplingCapacitors
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:
• Va lue and type of cap a citor: Recommendation
of 0.1 µF (100 nF), 10-20V. This capacitor should
be a 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: 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 PCB track
inductance.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
dsPIC33E/PIC24E
VDD
VSS
VDD
VSS
VSS
VDD
AVDD
AVSS
VDD
VSS
0.1 µF
Ceramic
0.1 µF
Ceramic
0.1 µF
Ceramic
0.1 µF
Ceramic
C
R
V
DD
MCLR
0.1 µF
Ceramic
VCAP
L1
(1)
R1
10 µF
Tantalum
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
F
CNV
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 flowing into
MCLR
from the external capacitor, C, in the
event of MCLR
pin breakdown, due to
Electrostatic Discharge (ESD) or Electrical
Overstress (EOS). Ensure that the MCLR
pin
V
IH and VIL specifications are met.
C
R1
(2)
R
(1)
VDD
MCLR
dsPIC33E/PIC24E
JP
FIGURE 2-1:RECOMMENDED
MINIMUM CONNECTION
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 FilterCapacitor
Connection (V
A low-ESR (< 1 Ohm) capacitor is required on the VCAP
pin, which is used to stabilize the voltage regulator
output voltage. The V
DD and must have a capacitor greater than 4.7 µF
V
(10 µF is recommended), 16V connected to ground. The
type can be ceramic or tantalum. See Section 30.0
“Electrical Characteristics” for additional information.
The placement of this capacitor should be close to the
CAP pin. It is recommended that the trace length not
V
exceeds one-quarter inch (6 mm). See Section 27.3
“On-Chip Voltage Regulator” for details.
CAP)
CAP pin must not be connected to
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-2, it is recommended
that the capacitor, C, be isolated from the MCLR
during programming and debugging operations.
Place the components as shown in Figure 2-2 within
one-quarter inch (6 mm) from the MCLR
FIGURE 2-2:EXAMPLE OF MCLR PIN
CONNECTIONS
pin. Consequently,
IH and VIL) and fast signal
pin
pin.
DS70000657H-page 30 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
Main Oscillator
Guard Ring
Guard Trace
Oscillator Pins
2.5ICSPPins
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 to exceed 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.
• “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
®
REAL ICE™ In-Circuit Emulator”
(poster) DS51749
2.6External OscillatorPins
Many DSCs have options for at least two oscillators: a
high-frequency Primary Oscillator and a low-frequency
Secondary Oscillator. For details, see Section 9.0
“Oscillator Configuration” for details.
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. A
suggested layout is shown in Figure 2-3.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
IPFC
VOUTPUT
ADC Channel Op Amp/ADC ChannelPWM
k
1
k
2
k
3
FET
dsPIC33EP
VINPUT
ComparatorOutput
Driver
2.7Oscillator Value Conditionson
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 3 MHz < F
IN < 5.5 MHz to comply with device PLL
start-up conditions. This means 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 that clock switching
must be enabled in the device Configuration Word.
2.8Unused I/Os
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.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
VAC
VOUT+
Op Amp/Comparator
PWM
ADC
PWM
|VAC|
k
4
k
3
FET
dsPIC33EP
Driver
V
OUT-
ADC Channel
FET
Driver
Op Amp/
k
1
k
2
Comparator
Channel
Op Amp/
Comparator
3-Phase
Inverter
PWM3H
PWM3L
PWM2H
PWM2L
PWM1H
PWM1L
FLTx
Fault
BLDC
dsPIC33EP/PIC24EP
AN3
AN4
AN5
AN2
Demand
Phase Terminal Voltage Feedback
R49R41 R34
R36
R44
R52
FIGURE 2-7:INTERLEAVED PFC
FIGURE 2-8:BEMF VOLTAGE MEASURED USING THE ADC MODULE
DS70000657H-page 34 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
3.0CPU
Note 1: This data sheet summarizes the
features of the dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X and
PIC24EPXXXGP/MC20X families 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 dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/
50X and PIC24EPXXXGP/MC20X 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 dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/
50X and PIC24EPXXXGP/MC20X devices have sixteen, 16-bit working registers in the programmer’s
model. Each of the working registers can act as a data,
address or address offset register. The 16th working
register (W15) operates as a Software Stack Pointer for
interrupts and calls.
3.2Instruction Set
The instruction set for dsPIC33EPXXXGP50X and
dsPIC33EPXXXMC20X/50X devices has two classes of
instructions: the MCU class of instructions and the DSP
class of instructions. The instruction set for
PIC24EPXXXGP/MC20X devices has the MCU class of
instructions only and does not support DSP 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 64 Kbytes
(32K words).
The Data Space includes two ranges of memory,
referred to as X and Y data memory. Each memory
range is accessible through 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 dsPIC33EPXXXMC20X/50X
and dsPIC33EPXXXGP50X 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 Spaces
have memory locations that are device-specific, and
are described further in the data memory maps in
Section 4.2 “Data Address Space”.
The upper 32 Kbytes of the Data Space memory map
can optionally be mapped into Program Space (PS) at
any 32-Kbyte aligned program word boundary. The
Program-to-Data 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 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. Refer to the “Data Memory” (DS70595) and
“Program Memory” (DS70613) sections in the
“dsPIC33/PIC24 Family Reference Manual” for more
details on EDS, PSV and table accesses.
On the dsPIC33EPXXXMC20X/50X and
dsPIC33EPXXXGP50X 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 re-ordering for radix-2 FFT
algorithms. PIC24EPXXXGP/MC20X devices do not
support Modulo and Bit-Reversed Addressing.
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.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
Instruction
Decode and
Control
16
PCL
16
Program Counter
16-Bit ALU
24
24
24
24
X Data Bus
PCU
16
16
16
Divide
Support
Engine
(1)
DSP
ROM Latch
16
Y Data Bus
(1)
EA MUX
X RAGU
X WAGU
Y AGU
(1)
16
24
16
16
16
16
16
16
16
8
Interrupt
Controller
PSV and Table
Data Access
Control Block
Stac k
Control
Logic
Loop
Control
Logic
Data LatchData Latch
Y Data
RAM
(1)
X Data
RAM
Address
Latch
Address
Latch
16
Data Latch
16
16
16
X Address Bus
Y Address Bus
24
Literal Data
Program Memory
Address Latch
Power, Reset
and Oscillator
Control Signals
to Various Blocks
Ports
Peripheral
Modules
Note 1:This feature is not available on PIC24EPXXXGP/MC20X devices.
Modules
PCH
IR
16 x 16
W Register Array
FIGURE 3-1:dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
CPU BLOCK DIAGRAM
DS70000657H-page 36 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
3.5Programmer’s Model
The programmer’s model for the
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X
and PIC24EPXXXGP/MC20X is shown in Figure 3-2.
All registers in the programmer’s model are memory
mapped and can be manipulated directly by
instructions. Tab le 3- 1 lists a description of each
register.
In addition to the registers contained in the
MC20X devices contain control registers for Modulo
Addressing (dsPIC33EPXXXMC20X/50X and
dsPIC33EPXXXGP50X devices only), Bit-Reversed
Addressing (dsPIC33EPXXXMC20X/50X and
dsPIC33EPXXXGP50X devices only) 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 Ta bl e 4 -1 .
programmer’s model, the dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X and PIC24EPXXXGP/
TABLE 3-1:PROGRAMMER’S MODEL REGISTER DESCRIPTIONS
Register(s) NameDescription
W0 through W15Working Register Array
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
DSWPAGExtended Data Space (EDS) Write Page Register
RCOUNTREPEAT Loop Count Register
DCOUNT
DOSTARTH
DOENDH
(1)
(1,2)
(1)
, DOENDL
, DOSTARTL
(1)
(1,2)
CORCONContains DSP Engine, DO Loop Control and Trap Status bits
Note 1:This register is available on dsPIC33EPXXXMC20X/50X and dsPIC33EPXXXGP50X devices only.
2:The DOSTARTH and DOSTARTL registers are read-only.
DO Loop Count Register
DO Loop Start Address Register (High and Low)
DO Loop End Address Register (High and Low)
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
NOVZ C
TBLPAG
PC23
PC0
7
0
D0D15
Program Counter
Data Table Page Address
STATUS Register
Working/Address
Registers
DSP Operand
Registers
W0 (WREG)
W1
W2
W3
W4
W5
W6
W7
W8
W9
W10
W11
W12
W13
Frame Pointer/W14
Stack Pointer/W15
DSP Address
Registers
AD39AD0
AD31
DSP
Accumulators
(1)
ACCA
ACCB
DSRPAG
9
0
RA
0
OA
(1)OB(1)SA(1)SB(1)
RCOUNT
15
0
Repeat Loop Counter
DCOUNT
150
DO Loop Counter and Stack
(1)
DOSTART
230
DO Loop Start Address and Stack
(1)
0
DOEND
DO Loop End Address and Stack
(1)
IPL2 IPL1
SPLIM
Stack Pointer Limit
AD15
23
0
SRL
IPL0
PUSH.s and POP.s Shadows
Nested DO Stack
0
0
OAB
(1)
SAB
(1)
X Data Space Read Page Address
DA
(1)
DC
0
0
0
0
DSWPAG
X Data Space Write Page Address
8
0
Note 1: This feature or bit is available on dsPIC33EPXXXMC20X/50X and dsPIC33EPXXXGP50X devices only.
CORCON
15
0
CPU Core Control Register
FIGURE 3-2:PROGRAMMER’S MODEL
DS70000657H-page 38 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
3.6CPU 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, which can be
accessed using this link, contains the latest updates
and additional information.
Note:In the event you are not able to access the
product page using the link above, enter
this URL in your browser:
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
3.7CPU 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
(1)
OA
bit 15bit 8
OB
(1)
SA
(1,4)
SB
(1,4)
OAB
(1)
SAB
(1)
DA
(1)
DC
R/W-0
(2,3)
R/W-0
(2,3)
R/W-0
(2,3)
R-0R/W-0R/W-0R/W-0R/W-0
IPL2IPL1IPL0RANOVZC
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)
1 = Accumulator A has overflowed
0 = Accumulator A has not overflowed
bit 14OB: Accumulator B Overflow Status bit
(1)
1 = Accumulator B has overflowed
0 = Accumulator B has not overflowed
bit 13SA: Accumulator A Saturation ‘Sticky’ Status bit
(1,4)
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,4)
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)
1 = Accumulators A or B have overflowed
0 = Neither Accumulators A or B have overflowed
bit 10SAB: SA || SB Combined Accumulator ‘Sticky’ Status bit
(1)
1 = Accumulators A or B are saturated or have been saturated at some time
0 = Neither Accumulators A or B are saturated
bit 9DA: DO Loop Active bit
(1)
1 = DO loop is in progress
0 = DO loop is not in progress
bit 8DC: MCU ALU Half Carry/Borrow
bit
1 = A carry-out from the 4th low-order bit (for byte-sized data) or 8th low-order bit (for word-sized data)
of the result occurred
0 = No carry-out from the 4th low-order bit (for byte-sized data) or 8th low-order bit (for word-sized
data) of the result occurred
Note 1:This bit is available on dsPIC33EPXXXMC20X/50X and dsPIC33EPXXXGP50X devices only.
2:The IPL<2:0> bits are concatenated with the IPL<3> bit (CORCON<3>) to form the CPU Interrupt Priority
Level. The value in parentheses indicates the IPL, if IPL<3> = 1. User interrupts are disabled when
IPL<3> = 1.
3:The IPL<2:0> Status bits are read-only when the NSTDIS bit (INTCON1<15>) = 1.
4: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 bit operations.
DS70000657H-page 40 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
REGISTER 3-1:SR: CPU STATUS REGISTER (CONTINUED)
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 in progress
0 = REPEAT loop 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 = No overflow occurred
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 of the result occurred
0 = No carry-out from the Most Significant bit of the result occurred
bit
(2,3)
Note 1:This bit is available on dsPIC33EPXXXMC20X/50X and dsPIC33EPXXXGP50X devices only.
2:The IPL<2:0> bits are concatenated with the IPL<3> bit (CORCON<3>) to form the CPU Interrupt Priority
Level. The value in parentheses indicates the IPL, if IPL<3> = 1. User interrupts are disabled when
IPL<3> = 1.
3:The IPL<2:0> Status bits are read-only when the NSTDIS bit (INTCON1<15>) = 1.
4: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 bit operations.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
3.8Arithmetic Logic Unit (ALU)
The dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/
50X and PIC24EPXXXGP/MC20X 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.
Data for the ALU operation can come from the W
register array or data memory, depending on the
addressing mode of the instruction. Likewise, output
data from the ALU can be written to the W register array
or a data memory location.
Refer to the “16-bit MCU and DSC Programmer’sReference Ma nual” (DS70157) for information on the
SR bits affected by each instruction.
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.8.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.8.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 one cycle per bit of divisor,
so both 32-bit/16-bit and 16-bit/16-bit instructions take
the same number of cycles to execute.
3.9DSP Engine
(dsPIC33EPXXXMC20X/50X and
dsPIC33EPXXXGP50X Devices
Only)
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 listed
below:
• 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)Ye s
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
DS70000657H-page 44 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
Reset Address
0x000000
0x000002
Write Latches
User Program
Flash Memory
0x0057EC
0x0057EA
(11K instructions)
0x800000
0xFA0000
0xFA0002
0xFA0004
DEVID
0xFEFFFE
0xFF0000
0xFFFFFE
0xF9FFFE
Unimplemented
(Read ‘
0
’s)
GOTO
Instruction
0x000004
Reserved
0x7FFFFE
Reserved
0x000200
0x0001FE
Interrupt Vector Table
Configuration Memory Space
User Memory Space
Flash Configuration
Bytes
0x005800
0x0057FE
Reserved
0xFF0002
Note:Memory areas are not shown to scale.
0xFF0004
Reserved
0x800FF8
0x800FF6
0x801000
0x800FFE
USERID
4.0MEMORY ORGANIZATION
Note:This data sheet summarizes the
features of the dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X and
PIC24EPXXXGP/MC20X families 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/PIC24 Family ReferenceManual”, which is available from the
Microchip web site (www.microchip.com).
The dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/
50X and PIC24EPXXXGP/MC20X 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)
4.1Program Address Space
The program address memory space of the
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X
and PIC24EPXXXGP/MC20X 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 Data Space
remapping, as described in Section 4.8 “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 0x7FFFFF). The exception is the use of
TBLRD operations, which use TBLPAG<7> to read
Device ID sections of the configuration memory space.
The program memory maps, which are presented by
device family and memory size, are shown in
Figure 4-1 through Figure 4-5.
during code execution.
FIGURE 4-1:PROGRAM MEMORY MAP FOR dsPIC33EP32GP50X, dsPIC33EP32MC20X/50X AND
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
0816
PC Address
0x000000
0x000002
0x000004
0x000006
23
00000000
00000000
00000000
00000000
Program Memory
‘Phantom’ Byte
(read as ‘0’)
least significant word
most significant word
Instruction Width
0x000001
0x000003
0x000005
0x000007
msw
Address(lsw Address)
4.1.1PROGRAM MEMORY
ORGANIZATION
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 (Figure 4-6).
Program memory addresses are always word-aligned
on the lower word and addresses are incremented, or
decremented by two, during code execution. This
arrangement provides compatibility with data memory
space addressing and makes data in the program
memory space accessible.
4.1.2INTERRUPT AND TRAP VECTORS
All dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/
50X and PIC24EPXXXGP/MC20X devices reserve the
addresses between 0x000000 and 0x000200 for hardcoded 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.
A more detailed discussion of the Interrupt Vector
Tables (IVTs) is provided in Section 7.1 “Interrupt
Vector Table”.
FIGURE 4-6:PROGRAM MEMORY ORGANIZATION
DS70000657H-page 50 2011-2013 Microchip Technology Inc.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
4.2Data Address S pace
The dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/
50X and PIC24EPXXXGP/MC20X CPU has a separate
16-bit-wide data memory space. The Data Space 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-7 through
Figure 4-16.
All Effective Addresses (EAs) in the data memory space
are 16 bits wide and point to bytes within the Data
Space. This arrangement gives a base Data Space
address range of 64 Kbytes (32K words).
The base Data Space address is used in conjunction
with a Read or Write Page register (DSRPAG or
DSWPAG) to form an Extended Data Space, which has
a total address range of 16 Mbytes.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X
and PIC24EPXXXGP/MC20X devices implement up to
52 Kbytes of data memory (4 Kbytes of data memory
for Special Function Registers and up to 48 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 Data
Space EAs resolve to bytes. The Least Significant
Bytes (LSBs) of each word have even addresses, while
the Most Significant Bytes (MSBs) have odd
addresses.
4.2.2DATA MEMORY ORGANIZATION
AND ALIGNMENT
To maintain backward compatibility with PIC
devices and improve Data Space memory
usage efficiency, the dsPIC33EPXXXGP50X,
dsPIC33EPXXXMC20X/50X and PIC24EPXXXGP/
MC20X instruction set supports both word and byte
operations. As a consequence of byte accessibility, all
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, so
care must be taken when mixing byte and word
operations, or translating from 8-bit MCU code. If a
misaligned read or write is attempted, an address error
trap 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
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X
and PIC24EPXXXGP/MC20X 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 Data Space 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.
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
4.2.5X AND Y DATA SPACES
The dsPIC33EPXXXMC20X/50X and
dsPIC33EPXXXGP50X 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 Data Space is used by all instructions and
supports all addressing modes. X Data Space has
separate read and write data buses. The X read data
bus is the read data path for all instructions that view
Data Space 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 Data Space is used in concert with the X Data
Space 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 X Data Space.
Modulo Addressing and Bit-Reversed Addressing are
not present in PIC24EPXXXGP/MC20X devices.
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.
4.3Memory 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, which can be
accessed using this link, contains the latest updates
and additional information.
Note:In the event you are not able to access the
product page using the link above, enter
this URL in your browser:
IC4CON2015A
IC4BUF015CInput Capture 4 Buffer Registerxxxx
IC4TMR015EInput Capture 4 Timer0000Legend: x = unknown value on Reset, — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
C1RXF15SID047CSID<10:3>SID<2:0>
C1RXF15EID047EEID<15:8>EID<7:0>xxxxLegend: x = unknown value on Reset, — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
—EXIDE—EID<17:16>xxxx
—EXIDE—EID<17:16>xxxx
—EXIDE—EID<17:16>xxxx
—EXIDE—EID<17:16>xxxx
All
Resets
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
DS70000657H-page 88 2011-2013 Microchip Technology Inc.
CRCXORL0644X<15:1>
CRCXORH0646X<31:16>0000
CRCDATL0648CRC Data Input Low Word0000
CRCDATH064ACRC Data Input High Word0000
CRCWDATL 064CCRC Result Low Word0000
CRCWDATH 064ECRC Result High Word0000Legend: — = unimplemented, read as ‘0’. Shaded bits are not used in the operation of the programmable CRC module.
File NameAddr. Bit 15Bit 14Bit 13Bit 12Bit 11Bit 10Bit 9Bit 8Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bi t 0
CMSTAT0A80 PSIDL
CVRCON0A82
CM1CON0A84CONCOECPOL
CM1MSKSRC0A86
CM1MSKCON0A88HLMS
CM1FLTR0A8A
CM2CON0A8CCONCOECPOL
CM2MSKSRC0A8E
CM2MSKCON0A90HLMS
CM2FLTR0A92
(1)
CM3CON
CM3MSKSRC
CM3MSKCON
CM3FLTR
CM4CON0A9CCONCOECPOL
CM4MSKSRC0A9E
CM4MSKCON0AA0 HLMS
CM4FLTR0AA2
Legend: — = unimplemented, read as ‘0’. Reset values are shown in hexadecimal.
Note 1:These registers are unavailable on dsPIC33EPXXXGP502/MC502/MC202 and PIC24EP256GP/MC202 (28-pin) devices.