Академический Документы
Профессиональный Документы
Культура Документы
Data Sheet
High-Performance,
16-bit Digital Signal Controllers
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
ISBN: 978-1-60932-898-6
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
UART
2 TM
CAN
SRAM EEPROM Timer Input A/D 10-bit Quad
SPI
Device Pins Mem. Bytes/ Comp/Std Control
I C
Bytes Bytes 16-bit Cap 1 Msps Enc
Instructions PWM PWM
80-Pin TQFP
EMUD2/OC2/RD1
CN16/UPDN/RD7
PWM2H/RE3
PWM1H/RE1
PWM2L/RE2
PWM1L/RE0
PWM3L/RE4
CN19/RD13
CN14/RD5
CN15/RD6
CN13/RD4
C1RX/RF0
C1TX/RF1
OC4/RD3
OC3/RD2
RD12
RG0
RG1
VDD
VSS
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
PWM3H/RE5 1 60 EMUC1/SOSCO/T1CK/CN0/RC14
PWM4L/RE6 2 59 EMUD1/SOSCI/CN1/RC13
PWM4H/RE7 3 58 EMUC2/OC1/RD0
T2CK/RC1 4 57 IC4/RD11
T4CK/RC3 5 56 IC3/RD10
SCK2/CN8/RG6 6 55 IC2/RD9
SDI2/CN9/RG7 7 54 IC1/RD8
SDO2/CN10/RG8 8 53 INT4/RA15
MCLR 9 52 INT3/RA14
SS2/CN11/RG9 10 dsPIC30F5016 51 VSS
VSS 11 50 OSC2/CLKO/RC15
VDD 12 49 OSC1/CLKI
FLTA/INT1/RE8 13 48 VDD
FLTB/INT2/RE9 14 47 SCL/RG2
AN5/QEB/CN7/RB5 15 46 SDA/RG3
AN4/QEA/CN6/RB4 16 45 EMUC3/SCK1/INT0/RF6
AN3/INDX/CN5/RB3 17 44 SDI1/RF7
AN2/SS1/CN4/RB2 18 43 EMUD3/SDO1/RF8
PGC/EMUC/AN1/CN3/RB1 19 42 U1RX/RF2
PGD/EMUD/AN0/CN2/RB0 20 41 U1TX/RF3
21
22
34
35
36
37
38
39
40
23
24
25
26
27
28
29
30
31
32
33
CN20/RD14
AN15/CN12/RB15
AVDD
AVSS
VSS
VDD
AN7/RB7
VREF-/RA9
VREF+/RA10
AN8/RB8
AN9/RB9
AN10/RB10
AN11/RB11
AN12/RB12
AN13/RB13
AN14/RB14
CN21/RD15
CN17/RF4
CN18/RF5
AN6/OCFA/RB6
64-Pin TQFP
EMUD2/OC2/RD1
UPDN/CN16/RD7
PWM2H/RE3
PWM1H/RE1
PWM3L/RE4
PWM2L/RE2
PWM1L/RE0
C1RX/RF0
CN15/RD6
CN14/RD5
CN13/RD4
C1TX/RF1
OC4/RD3
OC3/RD2
VDD
VSS
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
PWM3H/RE5 1 48 EMUC1/SOSCO/T1CK/CN0/RC14
PWM4L/RE6 2 47 EMUD1/SOSCI/T4CK/CN1/RC13
PWM4H/RE7 3 46 EMUC2/OC1/RD0
SCK2/CN8/RG6 4 45 IC4/INT4/RD11
SDI2/CN9/RG7 5 44 IC3/INT3/RD10
SDO2/CN10/RG8 6 43 IC2/FLTB/INT2/RD9
MCLR 7 42 IC1/FLTA/INT1/RD8
SS2/CN11/RG9 8 dsPIC30F5015 41 VSS
VSS 9 40 OSC2/CLKO/RC15
VDD 10 39 OSC1/CLKI
AN5/QEB/CN7/RB5 11 38 VDD
AN4/QEA/CN6/RB4 12 37 SCL/RG2
AN3/INDX/CN5/RB3 13 36 SDA/RG3
AN2/SS1/CN4/RB2 14 35 EMUC3/SCK1/INT0/RF6
AN1/VREF-/CN3/RB1 15 34 U1RX/SDI1/RF2
AN0/VREF+/CN2/RB0 16 33 EMUD3/U1TX/SDO1/RF3
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
PGD/EMUD/AN7/RB7
PGC/EMUC/AN6/OCFA/RB6
AN8/RB8
AN9/RB9
AN10/RB10
AN11/RB11
AN12/RB12
AN13/RB13
AN14/RB14
AN15/CN12/RB15
CN17/RF4
CN18/RF5
AVDD
AVSS
VSS
VDD
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.
Y Data Bus
X Data Bus
16 16 16 16
16
Interrupt Data Latch Data Latch
Controller PSV and Table
Data Access Y Data X Data
24 Control Block 8 16 RAM RAM
(1 Kbyte) (1 Kbyte)
Address Address
24 Latch Latch AN0/VREF+/CN2/RB0
16 16 16 AN1/VREF-/CN3/RB1
AN2/SS1/CN4/RB2
24 X RAGU
Y AGU AN3/INDX/CN5/RB3
PCU PCH PCL X WAGU
AN4/QEA/CN6/RB4
Program Counter
AN5/QEB/CN7/RB5
Address Latch Stack Loop
Control Control PGC/EMUC/AN6/OCFA/RB6
Program Memory Logic Logic PGD/EMUD/AN7/RB7
(66 Kbytes) AN8/RB8
AN9/RB9
Data EEPROM
AN10/RB10
(1 Kbyte) Effective Address
AN11/RB11
Data Latch 16 AN12/RB12
AN13/RB13
AN14/RB14
ROM Latch 16 AN15/CN12/RB15
24 PORTB
IR
EMUD1/SOSCI/T4CK/CN1/RC13
16 16
EMUC1/SOSCO/T1CK/CN0/RC14
16 x 16 OSC2/CLKO/RC15
W Reg Array
Decode
PORTC
Instruction
Decode and 16 16
Control EMUC2/OC1/RD0
EMUD2/OC2/RD1
Control Signals DSP OC3/RD2
to Various Blocks Divide OC4/RD3
Power-up Engine Unit
Timer CN13/RD4
CN14/RD5
OSC1/CLKI Timing Oscillator CN15/RD6
Generation Start-up Timer UPDN/CN16/RD7
POR/BOR ALU<16> IC1/FLTA/INT1/RD8
Reset IC2/FLTB/INT2/RD9
IC3/INT3/RD10
Watchdog 16 16 IC4/INT4/RD11
MCLR
Timer
Low-Voltage PORTD
VDD, VSS Detect
AVDD, AVSS
Input Output
CAN1 10-bit ADC Capture Compare I2C™ PWM1L/RE0
Module Module PWM1H/RE1
PWM2L/RE2
PWM2H/RE3
PWM3L/RE4
PWM3H/RE5
PWM4L/RE6
SPI1, QEI Motor Control UART1 PWM4H/RE7
Timers
SPI2 PWM
PORTE
C1RX/RF0
SCL/RG2 C1TX/RF1
SDA/RG3 U1RX/SDI1/RF2
SCK2/CN8/RG6 EMUD3/U1TX/SDO1/RF3
SDI2/CN9/RG7
CN17/RF4
SDO2/CN10/RG8
CN18/RF5
SS2/CN11/RG9 EMUC3/SCK1/INT0/RF6
PORTG PORTF
Y Data Bus
X Data Bus
16 16 16 16 VREF-/RA9
16
VREF+/RA10
Interrupt Data Latch Data Latch
PSV and Table INT3/RA14
Controller Y Data X Data
Data Access 8 INT4/RA15
24 Control Block 16 RAM RAM
(1 Kbyte) (1 Kbyte)
PORTA
Address Address
24 Latch Latch PGD/EMUD/AN0/CN2/RB0
16 16 16 PGC/EMUC/AN1/CN3/RB1
AN2/SS1/CN4/RB2
24 X RAGU
Y AGU AN3/INDX/CN5/RB3
PCU PCH PCL X WAGU
AN4/QEA/CN6/RB4
Program Counter
AN5/QEB/CN7/RB5
Address Latch Stack Loop
Control Control AN6/OCFA/RB6
Program Memory Logic Logic AN7/RB7
(66 Kbytes) AN8/RB8
AN9/RB9
Data EEPROM
AN10/RB10
(1 Kbyte) Effective Address
AN11/RB11
Data Latch 16 AN12/RB12
AN13/RB13
AN14/RB14
ROM Latch 16 AN15/CN12/RB15
24 PORTB
IR T2CK/RC1
T4CK/RC3
16 16 EMUD1/SOSCI/CN1/RC13
EMUC1/SOSCO/T1CK/CN0/RC14
16 x 16
OSC2/CLKO/RC15
W Reg Array
Decode
PORTC
Instruction
Decode and 16 16
Control EMUC2/OC1/RD0
EMUD2/OC2/RD1
OC3/RD2
Control Signals DSP
to Various Blocks Divide OC4/RD3
Power-up Engine Unit CN13/RD4
Timer CN14/RD5
Timing Oscillator CN15/RD6
OSC1/CLKI CN16/UPDN/RD7
Generation Start-up Timer
IC1/RD8
POR/BOR ALU<16> IC2/RD9
Reset IC3/RD10
Watchdog 16 16 IC4/RD11
MCLR RD12
Timer
CN19/RD13
Low-Voltage CN20/RD14
VDD, VSS Detect CN21/RD15
AVDD, AVSS PORTD
PWM1L/RE0
Input Output PWM1H/RE1
CAN1 10-bit ADC Capture Compare I2C™ PWM2L/RE2
Module Module
PWM2H/RE3
PWM3L/RE4
PWM3H/RE5
PWM4L/RE6
PWM4H/RE7
SPI1, QEI Motor Control FLTA/INT1/RE8
Timers UART1
SPI2 PWM FLTB/INT2/RE9
PORTE
C1RX/RF0
RG0
C1TX/RF1
RG1
U1RX/RF2
SCL/RG2
U1TX/RF3
SDA/RG3
SCK2/CN8/RG6 CN17/RF4
SDI2/CN9/RG7 CN18/RF5
SDO2/CN10/RG8 EMUC3/SCK1/INT0/RF6
SDI1/RF7
SS2/CN11/RG9
EMUD3/SDO1/RF8
PORTG PORTF
D15 D0
W0/WREG
PUSH.S Shadow
W1
DO Shadow
W2
W3 Legend
W4
DSP Operand W5
Registers
W6
W7
Working Registers
W8
W9
DSP Address
Registers W10
W11
W12/DSP Offset
W13/DSP Write Back
W14/Frame Pointer
W15/Stack Pointer
PC22 PC0
0 Program Counter
7 0
TABPAG
TBLPAG Data Table Page Address
7 0
PSVPAG Program Space Visibility Page Address
15 0
RCOUNT REPEAT Loop Counter
15 0
DCOUNT DO Loop Counter
22 0
DOSTART DO Loop Start Address
22
DOEND DO Loop End Address
15 0
CORCON Core Configuration Register
SRH SRL
S
a
40 40-bit Accumulator A 40 Round t 16
40-bit Accumulator B u
Logic r
a
Carry/Borrow Out t
Saturate e
Carry/Borrow In Adder
Negate
40
40 40
Barrel
16
Shifter
40
X Data Bus
Sign-Extend
Y Data Bus
32 16
Zero Backfill
32
33
17-bit
Multiplier/Scaler
16 16
To/From W Array
00007E
3.1 Program Address Space Reserved 000080
User Memory
Alternate Vector Table 000084
The program address space is 4M instruction words. It
Space
0000FE
User Flash 000100
is addressable by the 23-bit PC, table instruction
Program Memory
Effective Address (EA), or data space EA, when (22K instructions)
program space is mapped into data space, as defined 00AFFE
by Table 3-1. Note that the program space address is Reserved
00B000
incremented by two between successive program (Read ‘0’s)
words, in order to provide compatibility with data space 7FFBFE
addressing. 7FFC00
Data EEPROM
User program space access is restricted to the lower (1 Kbyte)
4M instruction word address range (0x000000 to 7FFFFE
800000
0x7FFFFE), for all accesses other than TBLRD/TBLWT,
which use TBLPAG<7> to determine user or configura-
tion space access. In TABLE 3-1: “Program Space
Address Construction”, bit 23 allows access to the
Device ID, the User ID and the Configuration bits.
Otherwise, bit 23 is always clear.
Reserved
Configuration Memory
8005BE
Space
8005C0
UNITID (32 instr.)
8005FE
800600
Reserved
F7FFFE
Device Configuration F80000
Registers F8000E
F80010
Reserved
FEFFFE
DEVID (2) FF0000
FFFFFE
23 bits
Using
Program 0 Program Counter 0
Counter
Select
1 EA
Using
Program 0 PSVPAG Reg
Space
Visibility 8 bits 15 bits
EA
User/ Byte
Configuration 24-bit EA
Space Select
Select
Note: Program Space Visibility cannot be used to access bits <23:16> of a word in program memory.
PC Address 23 16 8 0
0x000000 00000000
0x000002 00000000
0x000004 00000000
0x000006 00000000
TBLRDL.B (Wn<0> = 0)
TBLRDL.W
Program Memory
‘Phantom’ Byte
TBLRDL.B (Wn<0> = 1)
(Read as ‘0’).
TBLRDH.W
PC Address 23 16 8 0
0x000000 00000000
0x000002 00000000
0x000004 00000000
0x000006 00000000
TBLRDH.B (Wn<0> = 0)
Program Memory
‘Phantom’ Byte
(Read as ‘0’) TBLRDH.B (Wn<0> = 1)
3.1.2 DATA ACCESS FROM PROGRAM Note that by incrementing the PC by 2 for each
MEMORY USING PROGRAM SPACE program memory word, the Least Significant 15 bits of
VISIBILITY data space addresses directly map to the Least Signif-
icant 15 bits in the corresponding program space
The upper 32 Kbytes of data space may optionally be addresses. The remaining bits are provided by the
mapped into any 16K word program space page. This Program Space Visibility Page register, PSVPAG<7:0>,
provides transparent access of stored constant data as shown in Figure 3-5.
from X data space, without the need to use special
instructions (i.e., TBLRDL/H, TBLWTL/H instructions). Note: PSV access is temporarily disabled during
table reads/writes.
Program space access through the data space occurs
if the MSb of the data space EA is set and program For instructions which use PSV that are executed
space visibility is enabled, by setting the PSV bit in the outside a REPEAT loop:
Core Control register (CORCON). The functions of
• The following instructions will require one instruc-
CORCON are discussed in Section 2.4 “DSP
tion cycle in addition to the specified execution
Engine”.
time:
Data accesses to this area add an additional cycle to - MAC class of instructions with data operand
the instruction being executed, since two program prefetch
memory fetches are required.
- MOV instructions
Note that the upper half of addressable data space is - MOV.D instructions
always part of the X data space. Therefore, when a
• All other instructions will require two instruction
DSP operation uses program space mapping to access
cycles in addition to the specified execution time
this memory region, Y data space should typically con-
of the instruction.
tain state (variable) data for DSP operations, whereas
X data space should typically contain coefficient For instructions that use PSV which are executed
(constant) data. inside a REPEAT loop:
Although each data space address, 0x8000 and higher, • The following instances will require two instruction
maps directly into a corresponding program memory cycles in addition to the specified execution time
address (see Figure 3-5), only the lower 16 bits of the of the instruction:
24-bit program word are used to contain the data. The - Execution in the first iteration
upper 8 bits should be programmed to force an illegal - Execution in the last iteration
instruction to maintain machine robustness. Refer - Execution prior to exiting the loop due to an
to the “16-bit MCU and DSC Programmer’s Reference interrupt
Manual” (DS70157) for details on instruction encoding.
- Execution upon re-entering the loop after an
interrupt is serviced
• Any other iteration of the REPEAT loop will allow
the instruction, accessing data using PSV, to
execute in a single cycle.
15 PSVPAG(1)
EA<15> = 0 0x00
8
Data 16
Space 0x8000
EA 15 23 15 0
Address
EA<15> = 1 0x001200
15 Concatenation 23
Note 1: PSVPAG is an 8-bit register, containing bits <22:15> of the program space address
(i.e., it defines the page in program space to which the upper half of data space is being mapped).
3.2 Data Address Space When executing any instruction other than one of the
MAC class of instructions, the X block consists of the
The core has two data spaces. The data spaces can be 64 Kbyte data address space (including all Y
considered either separate (for some DSP instruc- addresses). When executing one of the MAC class of
tions), or as one unified linear address range (for MCU instructions, the X block consists of the 64 Kbyte data
instructions). The data spaces are accessed using two address space excluding the Y address block (for data
Address Generation Units (AGUs) and separate data reads only). In other words, all other instructions
paths. regard the entire data memory as one composite
address space. The MAC class instructions extract the
3.2.1 DATA SPACE MEMORY MAP Y address space from data space and address it using
The data space memory is split into two blocks, X and EAs sourced from W10 and W11. The remaining X
Y data space. A key element of this architecture is that data space is addressed using W8 and W9. Both
Y space is a subset of X space, and is fully contained address spaces are concurrently accessed only with
within X space. In order to provide an apparent linear the MAC class instructions.
addressing space, X and Y spaces have contiguous A data space memory map is shown in Figure 3-6.
addresses.
Figure 3-7 shows a graphical summary of how X and Y
data spaces are accessed for MCU and DSP
instructions.
MSB LSB
Address 16 bits Address
MSB LSB
0x0001 0x0000
2 Kbyte SFR Space
SFR Space 0x07FE
0x07FF
0x0801 0x0800
0x0FFF 0x0FFE
0x1001 Unimplemented 0x1000
0x1FFF 0x1FFE
≈ Unimplemented ≈
0x8001 0x8000
X Data
Unimplemented (X)
Optionally
Mapped
into Program
Memory
0xFFFF 0xFFFE
X SPACE
UNUSED
X SPACE
X SPACE
UNUSED
Indirect EA using any W Indirect EA using W10, W11 Indirect EA using W8, W9
dsPIC30F5015/5016
Address
SFR Name Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
(Home)
W0 0000 W0/WREG 0000 0000 0000 0000
W1 0002 W1 0000 0000 0000 0000
W2 0004 W2 0000 0000 0000 0000
W3 0006 W3 0000 0000 0000 0000
W4 0008 W4 0000 0000 0000 0000
W5 000A W5 0000 0000 0000 0000
W6 000C W6 0000 0000 0000 0000
W7 000E W7 0000 0000 0000 0000
W8 0010 W8 0000 0000 0000 0000
W9 0012 W9 0000 0000 0000 0000
W10 0014 W10 0000 0000 0000 0000
W11 0016 W11 0000 0000 0000 0000
W12 0018 W12 0000 0000 0000 0000
W13 001A W13 0000 0000 0000 0000
W14 001C W14 0000 0000 0000 0000
W15 001E W15 0000 1000 0000 0000
SPLIM 0020 SPLIM 0000 0000 0000 0000
ACCAL 0022 ACCAL 0000 0000 0000 0000
ACCAH 0024 ACCAH 0000 0000 0000 0000
ACCAU 0026 Sign-Extension (ACCA<39>) ACCAU 0000 0000 0000 0000
ACCBL 0028 ACCBL 0000 0000 0000 0000
ACCBH 002A ACCBH 0000 0000 0000 0000
ACCBU 002C Sign-Extension (ACCB<39>) ACCBU 0000 0000 0000 0000
PCL 002E PCL 0000 0000 0000 0000
PCH 0030 — — — — — — — — — PCH 0000 0000 0000 0000
TBLPAG 0032 — — — — — — — — TBLPAG 0000 0000 0000 0000
PSVPAG 0034 — — — — — — — — PSVPAG 0000 0000 0000 0000
© 2011 Microchip Technology Inc.
Address
SFR Name Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
(Home)
MODCON 0046 XMODEN YMODEN — — BWM<3:0> YWM<3:0> XWM<3:0> 0000 0000 0000 0000
XMODSRT 0048 XS<15:1> 0 uuuu uuuu uuuu uuu0
XMODEND 004A XE<15:1> 1 uuuu uuuu uuuu uuu1
YMODSRT 004C YS<15:1> 0 uuuu uuuu uuuu uuu0
YMODEND 004E YE<15:1> 1 uuuu uuuu uuuu uuu1
XBREV 0050 BREN XB<14:0> uuuu uuuu uuuu uuuu
DISICNT 0052 — — DISICNT<13:0> 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F5015/5016
DS70149E-page 35
dsPIC30F5015/5016
NOTES:
• Register Direct
4.2 Modulo Addressing
• Register Indirect
• Register Indirect Post-Modified Modulo Addressing is a method of providing an auto-
• Register Indirect Pre-Modified mated means to support circular data buffers using
hardware. The objective is to remove the need for
• Register Indirect with Register Offset (Indexed)
software to perform data address boundary checks
• Register Indirect with Literal Offset when executing tightly looped code, as is typical in
• 8-bit Literal many DSP algorithms.
• 16-bit Literal Modulo Addressing can operate in either data or pro-
Note: Not all instructions support all the gram space (since the data pointer mechanism is essen-
addressing modes given above. Individual tially the same for both). One circular buffer can be
instructions may support different subsets supported in each of the X (which also provides the
of these addressing modes. pointers into program space) and Y data spaces. Modulo
Addressing can operate on any W register pointer. How-
4.1.4 MAC INSTRUCTIONS ever, it is not advisable to use W14 or W15 for Modulo
Addressing, since these two registers are used as the
The dual source operand DSP instructions (CLR, ED,
Stack Frame Pointer and Stack Pointer, respectively.
EDAC, MAC, MPY, MPY.N, MOVSAC and MSC), also
referred to as MAC instructions, utilize a simplified set of In general, any particular circular buffer can only be
addressing modes to allow the user to effectively configured to operate in one direction, as there are cer-
manipulate the data pointers through Register Indirect tain restrictions on the buffer start address (for incre-
tables. menting buffers) or end address (for decrementing
buffers) based upon the direction of the buffer.
The two source operand prefetch registers must be a
member of the set {W8, W9, W10, W11}. For data The only exception to the usage restrictions is for buf-
reads, W8 and W9 will always be directed to the X fers which have a power-of-2 length. As these buffers
RAGU and W10 and W11 will always be directed to the satisfy the start and end address criteria, they may
Y AGU. The effective addresses generated (before and operate in a Bidirectional mode, (i.e., address bound-
after modification) must, therefore, be valid addresses ary checks will be performed on both the lower and
within X data space for W8 and W9 and Y data space upper address boundaries).
for W10 and W11.
Note: Register Indirect with Register Offset
Addressing is only available for W9 (in X
space) and W11 (in Y space).
0x1163
Pivot Point
XB = 0x0008 for a 16-word Bit-Reversed Buffer
This trap is initiated under the following conditions: Reset - GOTO Instruction 0x000000
1. The Stack Pointer is loaded with a value which Reset - GOTO Address 0x000002
is greater than the (user-programmable) limit Reserved 0x000004
value written into the SPLIM register (stack Oscillator Fail Trap Vector
overflow). Address Error Trap Vector
Stack Error Trap Vector
2. The Stack Pointer is loaded with a value which
Decreasing
Note 1: The user can always lower the priority 5.7 External Interrupt Requests
level by writing a new value into SR. The
Interrupt Service Routine must clear the The interrupt controller supports five external interrupt
interrupt flag bits in the IFSx register request signals, INT0-INT4. These inputs are edge
before lowering the processor interrupt sensitive; they require a low-to-high or a high-to-low
priority in order to avoid recursive transition to generate an interrupt request. The
interrupts. INTCON2 register has five bits, INT0EP-INT4EP, that
select the polarity of the edge detection circuitry.
2: The IPL3 bit (CORCON<3>) is always
clear when interrupts are being pro-
5.8 Wake-up from Sleep and Idle
cessed. It is set only during execution of
traps. The interrupt controller may be used to wake-up the
processor from either Sleep or Idle modes, if Sleep or
The RETFIE (Return from Interrupt) instruction will
Idle mode is active when the interrupt is generated.
unstack the program counter and STATUS registers to
return the processor to its state prior to the interrupt If an enabled interrupt request of sufficient priority is
sequence. received by the interrupt controller, then the standard
interrupt request is presented to the processor. At the
same time, the processor will wake-up from Sleep or
Idle and begin execution of the Interrupt Service
Routine (ISR) needed to process the interrupt request.
dsPIC30F5015/5016
SFR
ADR Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
INTCON1 0080 NSTDIS — — — — OVATE OVBTE COVTE — — — MATHERR ADDRERR STKERR OSCFAIL — 0000 0000 0000 0000
INTCON2 0082 ALTIVT DISI — — — — — — — — — INT4EP INT3EP INT2EP INT1EP INT0EP 0000 0000 0000 0000
IFS0 0084 CNIF MI2CIF SI2CIF NVMIF ADIF U1TXIF U1RXIF SPI1IF T3IF T2IF OC2IF IC2IF T1IF OC1IF IC1IF INT0IF 0000 0000 0000 0000
IFS1 0086 — — IC4IF IC3IF C1IF SPI2IF — — INT2IF T5IF T4IF OC4IF OC3IF — — INT1IF 0000 0000 0000 0000
IFS2 0088 — — — FLTBIF FLTAIF — — QEIIF PWMIF — INT4IF INT3IF — — — — 0000 0000 0000 0000
IEC0 008C CNIE MI2CIE SI2CIE NVMIE ADIE U1TXIE U1RXIE SPI1IE T3IE T2IE OC2IE IC2IE T1IE OC1IE IC1IE INT0IE 0000 0000 0000 0000
IEC1 008E — — IC4IE IC3IE C1IE SPI2IE — — INT2IE T5IE T4IE OC4IE OC3IE — — INT1IE 0000 0000 0000 0000
IEC2 0090 — — — FLTBIE FLTAIE — — QEIIE PWMIE — INT4IE INT3IE — — — — 0000 0000 0000 0000
IPC0 0094 — T1IP<2:0> — OC1IP<2:0> — IC1IP<2:0> — INT0IP<2:0> 0100 0100 0100 0100
IPC1 0096 — T31P<2:0> — T2IP<2:0> — OC2IP<2:0> — IC2IP<2:0> 0100 0100 0100 0100
IPC2 0098 — ADIP<2:0> — U1TXIP<2:0> — U1RXIP<2:0> — SPI1IP<2:0> 0100 0100 0100 0100
IPC3 009A — CNIP<2:0> — MI2CIP<2:0> — SI2CIP<2:0> — NVMIP<2:0> 0100 0100 0100 0100
IPC4 009C — OC3IP<2:0> — — — — — — — — — INT1IP<2:0> 0100 0000 0000 0100
IPC5 009E — INT2IP<2:0> — T5IP<2:0> — T4IP<2:0> — OC4IP<2:0> 0100 0100 0100 0100
IPC6 00A0 — C1IP<2:0> — SPI2IP<2:0> — — — — — — — — 0100 0100 0000 0000
IPC7 00A2 — — — — — — — — — IC4IP<2:0> — IC3IP<2:0> 0000 0000 0100 0100
IPC8 00A4 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC9 00A6 — PWMIP<2:0> — — — — — INT41IP<2:0> — INT3IP<2:0> 0100 0000 0100 0100
IPC10 00A8 — FLTAIP<2:0> — — — — — — — — — QEIIP<2:0> 0100 0000 0000 0100
IPC11 00AA — — — — — — — — — — — — — FLTBIP<2:0> 0000 0000 0000 0100
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2011 Microchip Technology Inc.
TABLE 5-3: INTERRUPT CONTROLLER REGISTER MAP FOR dsPIC30F5016(1)
© 2011 Microchip Technology Inc.
SFR
ADR Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
INTCON1 0080 NSTDIS — — — — OVATE OVBTE COVTE — — — MATHERR ADDRERR STKERR OSCFAIL — 0000 0000 0000 0000
INTCON2 0082 ALTIVT — — — — — — — — — — INT4EP INT3EP INT2EP INT1EP INT0EP 0000 0000 0000 0000
IFS0 0084 CNIF MI2CIF SI2CIF NVMIF ADIF U1TXIF U1RXIF SPI1IF T3IF T2IF OC2IF IC2IF T1IF OC1IF IC1IF INT0IF 0000 0000 0000 0000
IFS1 0086 — — IC4IF IC3IF C1IF SPI2IF — — INT2IF T5IF T4IF OC4IF OC3IF — — INT1IF 0000 0000 0000 0000
IFS2 0088 — — — FLTBIF FLTAIF — — QEIIF PWMIF — INT4IF INT3IF — — — — 0000 0000 0000 0000
IEC0 008C CNIE MI2CIE SI2CIE NVMIE ADIE U1TXIE U1RXIE SPI1IE T3IE T2IE OC2IE IC2IE T1IE OC1IE IC1IE INT0IE 0000 0000 0000 0000
IEC1 008E — — IC4IE IC3IE C1IE SPI2IE — — INT2IE T5IE T4IE OC4IE OC3IE — — INT1IE 0000 0000 0000 0000
IEC2 0090 — — — FLTBIE FLTAIE — — QEIIE PWMIE — INT4IE INT3IE — — — — 0000 0000 0000 0000
IPC0 0094 — T1IP<2:0> — OC1IP<2:0> — IC1IP<2:0> — INT0IP<2:0> 0100 0100 0100 0100
IPC1 0096 — T31P<2:0> — T2IP<2:0> — OC2IP<2:0> — IC2IP<2:0> 0100 0100 0100 0100
IPC2 0098 — ADIP<2:0> — U1TXIP<2:0> — U1RXIP<2:0> — SPI1IP<2:0> 0100 0100 0100 0100
IPC3 009A — CNIP<2:0> — MI2CIP<2:0> — SI2CIP<2:0> — NVMIP<2:0> 0100 0100 0100 0100
IPC4 009C — OC3IP<2:0> — — — — — — — — — INT1IP<2:0> 0100 0000 0000 0100
IPC5 009E — INT2IP<2:0> — T5IP<2:0> — T4IP<2:0> — OC4IP<2:0> 0100 0100 0100 0100
IPC6 00A0 — C1IP<2:0> — SPI2IP<2:0> — — — — — — — — 0100 0100 0000 0000
IPC7 00A2 — — — — — — — — — IC4IP<2:0> — IC3IP<2:0> 0000 0000 0100 0100
IPC8 00A4 — — — — — — — — — — — — — — — — 0000 0000 0000 0100
IPC9 00A6 — PWMIP<2:0> — — — — — INT41IP<2:0> — INT3IP<2:0> 0100 0000 0100 0100
IPC10 00A8 — FLTAIP<2:0> — — — — — — — — — QEIIP<2:0> 0100 0000 0000 0100
dsPIC30F5015/5016
IPC11 00AA — — — — — — — — — — — — — FLTBIP<2:0> 0000 0000 0000 0100
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70149E-page 49
dsPIC30F5015/5016
NOTES:
NVMADR Reg EA
Using
NVMADR 1/0 NVMADRU Reg
Addressing
8 bits 16 bits
Working Reg EA
Byte
User/Configuration Select
Space Select 24-bit EA
Note: In Example 6-2, the contents of the upper byte of W3 has no effect.
File Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 All Resets
NVMCON 0760 WR WREN WRERR — — — — TWRI — PROGOP<6:0> 0000 0000 0000 0000
NVMADR 0762 NVMADR<15:0> uuuu uuuu uuuu uuuu
NVMADRU 0764 — — — — — — — — NVMADR<23:16> 0000 0000 uuuu uuuu
NVMKEY 0766 — — — — — — — — KEY<7:0> 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F5015/5016
DS70149E-page 55
dsPIC30F5015/5016
NOTES:
Read TRIS
I/O Cell
TRIS Latch
Data Bus D Q
WR TRIS CK
Data Latch
D Q I/O Pad
WR LAT+
CK
WR Port
Read LAT
Read Port
PIO Module 1
Output Data
0
Read TRIS
I/O Pad
Data Bus D Q
WR TRIS CK
TRIS Latch
D Q
WR LAT +
WR Port CK
Data Latch
Read LAT
Input Data
Read Port
8.2 Configuring Analog Port Pins 8.2.1 I/O PORT WRITE/READ TIMING
The use of the ADPCFG and TRIS registers control the One instruction cycle is required between a port
operation of the A/D port pins. The port pins that are direction change or port write operation and a read
desired as analog inputs must have their correspond- operation of the same port. Typically this instruction
ing TRIS bit set (input). If the TRIS bit is cleared would be a NOP.
(output), the digital output level (VOH or VOL) will be
converted. EXAMPLE 8-1: PORT WRITE/READ
When reading the PORT register, all pins configured as EXAMPLE
analog input channels will read as cleared (a low level). MOV 0xFF00, W0 ; Configure PORTB<15:8>
; as inputs
Pins configured as digital inputs will not convert an ana- MOV W0, TRISBB ; and PORTB<7:0> as outputs
log input. Analog levels on any pin that is defined as a NOP ; Delay 1 cycle
digital input (including the ANx pins) may cause the BTSS PORTB, #13 ; Next Instruction
input buffer to consume current that exceeds the
device specifications.
SFR Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
TRISA 02C0 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
PORTA 02C2 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
LATA 02C4 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
TRISB 02C6 TRISB15 TRISB14 TRISB13 TRISB12 TRISB11 TRISB10 TRISB9 TRISB8 TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 1111 1111 1111 1111
PORTB 02C8 RB15 RB14 RB13 RB12 RB11 RB10 RB9 RB8 RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 0000 0000 0000 0000
LATB 02CB LATB15 LATB14 LATB13 LATB12 LATB11 LATB10 LATB9 LATB8 LATB7 LATB6 LATB5 LATB4 LATB3 LATB2 LATB1 LATB0 0000 0000 0000 0000
TRISC 02CC TRISC15 TRISC14 TRISC13 — — — — — — — — — — — — — 1110 0000 0000 0000
PORTC 02CE RC15 RC14 RC13 — — — — — — — — — — — — — 0000 0000 0000 0000
LATC 02D0 LATC15 LATC14 LATC13 — — — — — — — — — — — — — 0000 0000 0000 0000
TRISD 02D2 — — — — TRISD11 TRISD10 TRISD9 TRISD8 TRISD7 TRISD6 TRISD5 TRISD4 TRISD3 TRISD2 TRISD1 TRISD0 0000 1111 1111 1111
PORTD 02D4 — — — — RD11 RD10 RD9 RD8 RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0 0000 0000 0000 0000
LATD 02D6 LATD11 LATD10 LATD9 LATD8 LATD7 LATD6 LATD5 LATD4 LATD3 LATD2 LATD1 LATD0 0000 0000 0000 0000
TRISE 02D8 — — — — — — — — TRISE7 TRISE6 TRISE5 TRISE4 TRISE3 TRISE2 TRISE1 TRISE0 0000 0000 1111 1111
PORTE 02DA — — — — — — — — RE7 RE6 RE5 RE4 RE3 RE2 RE1 RE0 0000 0000 0000 0000
LATE 02DC — — — — — — — — LATE7 LATE6 LATE5 LATE4 LATE3 LATE2 LATE1 LATE0 0000 0000 0000 0000
TRISF 02EE — — — — — — — — — TRISF6 TRISF5 TRISF4 TRISF3 TRISF2 TRISF1 TRISF0 0000 0000 0111 1111
PORTF 02E0 — — — — — — — — — RF6 RF5 RF4 RF3 RF2 RF1 RF0 0000 0000 0000 0000
LATF 02E2 — — — — — — — — — LATF6 LATF5 LATF4 LATF3 LATF2 LATF1 LATF0 0000 0000 0000 0000
TRISG 02E4 — — — — — — TRISG9 TRISG8 TRISG7 TRISG6 — — TRISG3 TRISG2 — — 0000 0011 1100 1100
dsPIC30F5015/5016
PORTG 02E6 — — — — — — RG9 RG8 RG7 RG6 — — RG3 RG2 — — 0000 0000 0000 0000
LATG 02E8 — — — — — — LATG9 LATG8 LATG7 LATG6 — — LATG3 LATG2 — — 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70149E-page 63
TABLE 8-2: dsPIC30F5016 PORT REGISTER MAP(1)
DS70149E-page 64
dsPIC30F5015/5016
SFR Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
TRISA 02C0 TRISA15 TRISA14 — — — TRISA10 TRISA9 — — — — — — — — — 1100 0110 0000 0000
PORTA 02C2 RA15 RA14 — — — RA10 RA9 — — — — — — — — — 0000 0000 0000 0000
LATA 02C4 LATA15 LATA14 — — — LATA10 LATA9 — — — — — — — — — 0000 0000 0000 0000
TRISB 02C6 TRISB15 TRISB14 TRISB13 TRISB12 TRISB11 TRISB10 TRISB9 TRISB8 TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 1111 1111 1111 1111
PORTB 02C8 RB15 RB14 RB13 RB12 RB11 RB10 RB9 RB8 RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 0000 0000 0000 0000
LATB 02CB LATB15 LATB14 LATB13 LATB12 LATB11 LATB10 LATB9 LATB8 LATB7 LATB6 LATB5 LATB4 LATB3 LATB2 LATB1 LATB0 0000 0000 0000 0000
TRISC 02CC TRISC15 TRISC14 TRISC13 — — — — — — — — — TRISC3 — TRISC1 — 1110 0000 0000 1010
PORTC 02CE RC15 RC14 RC13 — — — — — — — — — RC3 — RC1 — 0000 0000 0000 0000
LATC 02D0 LATC15 LATC14 LATC13 — — — — — — — — — LATC3 — LATC1 — 0000 0000 0000 0000
TRISD 02D2 TRISD15 TRISD14 TRISD13 TRISD12 TRISD11 TRISD10 TRISD9 TRISD8 TRISD7 TRISD6 TRISD5 TRISD4 TRISD3 TRISD2 TRISD1 TRISD0 1111 1111 1111 1111
PORTD 02D4 RD15 RD14 RD13 RD12 RD11 RD10 RD9 RD8 RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0 0000 0000 0000 0000
LATD 02D6 LATD15 LATD14 LATD13 LATD12 LATD11 LATD10 LATD9 LATD8 LATD7 LATD6 LATD5 LATD4 LATD3 LATD2 LATD1 LATD0 0000 0000 0000 0000
TRISE 02D8 — — — — — — TRISE9 TRISE8 TRISE7 TRISE6 TRISE5 TRISE4 TRISE3 TRISE2 TRISE1 TRISE0 0000 0011 1111 1111
PORTE 02DA — — — — — — RE9 RE8 RE7 RE6 RE5 RE4 RE3 RE2 RE1 RE0 0000 0000 0000 0000
LATE 02DC — — — — — — LATE9 LATE8 LATE7 LATE6 LATE5 LATE4 LATE3 LATE2 LATE1 LATE0 0000 0000 0000 0000
TRISF 02EE — — — — — — — TRISF8 TRISF7 TRISF6 TRISF5 TRISF4 TRISF3 TRISF2 TRISF1 TRISF0 0000 0001 1111 1111
PORTF 02E0 — — — — — — — RF8 RF7 RF6 RF5 RF4 RF3 RF2 RF1 RF0 0000 0000 0000 0000
LATF 02E2 — — — — — — — LATF8 LATF7 LATF6 LATF5 LATF4 LATF3 LATF2 LATF1 LATF0 0000 0000 0000 0000
TRISG 02E4 — — — — — — TRISG9 TRISG8 TRISG7 TRISG6 — — TRISG3 TRISG2 TRISG1 TRISG0 0000 0011 1100 1111
PORTG 02E6 — — — — — — RG9 RG8 RG7 RG6 — — RG3 RG2 RG1 RG0 0000 0000 0000 0000
LATG 02E8 — — — — — — LATG9 LATG8 LATG7 LATG6 — — LATG3 LATG2 LATG1 LATG0 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2011 Microchip Technology Inc.
dsPIC30F5015/5016
8.3 Input Change Notification Module when the clocks are disabled. There are 22 external
signals (CN0 through CN21) that may be selected
The input change notification module provides the (enabled) for generating an interrupt request on a
dsPIC30F devices the ability to generate interrupt change-of-state.
requests to the processor in response to a change-of-
state on selected input pins. This module is capable of Please refer to the pin diagrams for CN pin locations.
detecting input change-of-states, even in Sleep mode
TABLE 8-3: INPUT CHANGE NOTIFICATION REGISTER MAP (BITS 15-8) FOR dsPIC30F5015(1)
SFR
Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Reset State
Name
CNEN1 00C0 CN15IE CN14IE CN13IE CN12IE CN11IE CN10IE CN9IE CN8IE 0000 0000 0000 0000
CNEN2 00C2 — — — — — — — — 0000 0000 0000 0000
CNPU1 00C4 CN15PUE CN14PUE CN13PUE CN12PUE CN11PUE CN10PUE CN9PUE CN8PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — — — — 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 8-4: INPUT CHANGE NOTIFICATION REGISTER MAP (BITS 7-0) FOR dsPIC30F5015(1)
SFR
Addr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
CNEN1 00C0 CN7IE CN6IE CN5IE CN4IE CN3IE CN2IE CN1IE CN0IE 0000 0000 0000 0000
CNEN2 00C2 — — — — — CN18IE CN17IE CN16IE 0000 0000 0000 0000
CNPU1 00C4 CN7PUE CN6PUE CN5PUE CN4PUE CN3PUE CN2PUE CN1PUE CN0PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — CN18PUE CN17PUE CN16PUE 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 8-5: INPUT CHANGE NOTIFICATION REGISTER MAP (BITS 15-8) FOR dsPIC30F5016(1)
SFR
Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Reset State
Name
CNEN1 00C0 CN15IE CN14IE CN13IE CN12IE CN11IE CN10IE CN9IE CN8IE 0000 0000 0000 0000
CNEN2 00C2 — — — — — — — — 0000 0000 0000 0000
CNPU1 00C4 CN15PUE CN14PUE CN13PUE CN12PUE CN11PUE CN10PUE CN9PUE CN8PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — — — — 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 8-6: INPUT CHANGE NOTIFICATION REGISTER MAP (BITS 7-0) FOR dsPIC30F5016(1)
SFR
Addr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
CNEN1 00C0 CN7IE CN6IE CN5IE CN4IE CN3IE CN2IE CN1IE CN0IE 0000 0000 0000 0000
CNEN2 00C2 — — CN21IE CN20IE CN19IE CN18IE CN17IE CN16IE 0000 0000 0000 0000
CNPU1 00C4 CN7PUE CN6PUE CN5PUE CN4PUE CN3PUE CN2PUE CN1PUE CN0PUE 0000 0000 0000 0000
CNPU2 00C6 — — CN21PUE CN20PUE CN19PUE CN18PUE CN17PUE CN16PUE 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
PR1
Equal
Comparator x 16 TSYNC
1 Sync
TMR1
Reset
0
0
T1IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
SOSCO/ TON 2
1x
T1CK
SOSCI
TCY 00
C1
SOSCI
C1 = C2 = 18 pF; R = 100K
dsPIC30F5015/5016
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
TMR3HLD
16
16
Write TMR2
Read TMR2
16
Reset
TMR3 TMR2 Sync
MSB LSB
ADC Event Trigger
Comparator x 32
Equal
PR3 PR2
0
T3IF
Event Flag 1 Q D TGATE (T2CON<6>)
Q CK
TGATE
(T2CON<6>)
TGATE
TCS
TCKPS<1:0>
TON 2
T2CK 1x
Prescaler
Gate 1, 8, 64, 256
Sync 01
TCY
00
Note: Timer Configuration bit T32, (T2CON<3>), must be set to ‘1’ for a 32-bit timer/counter operation. All control
bits are respective to the T2CON register.
PR2
Equal
Comparator x 16
TMR2 Sync
Reset
0
T2IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
TON 2
T2CK(1) 1x
Gate Prescaler
Sync 01 1, 8, 64, 256
TCY 00
Note 1: T2CK input is not available on dsPIC30F5015. This input is grounded as shown in Figure 10-3.
PR3
TMR3
Reset
0
T3IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
TON 2
Sync 1x
Prescaler
01 1, 8, 64, 256
TCY 00
Note: The dsPIC30F5015/5016 devices do not have external pin inputs to Timer3. In these devices, the following
modes should not be used:
1. TCS = 1
2. TCS = 0 and TGATE = 1 (gated time accumulation)
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
dsPIC30F5015/5016
DS70149E-page 75
dsPIC30F5015/5016
NOTES:
This section describes the second 32-bit General Note: For 32-bit timer operation, T5CON control
Purpose timer module (Timer4/5) and associated oper- bits are ignored. Only T4CON control bits
ational modes. Figure 11-1 depicts the simplified block are used for setup and control. Timer4
diagram of the 32-bit Timer4/5 module. Figure 11-2 and clock and gate inputs are utilized for the
Figure 11-3 show Timer4/5 configured as two indepen- 32-bit timer module, but an interrupt is
dent 16-bit timers, Timer4 and Timer5, respectively. generated with the Timer5 Interrupt Flag
(T5IF) and the interrupt is enabled with the
Note: Timer4 is a Type B timer and Timer5 is a Timer5 Interrupt Enable bit (T5IE).
Type C timer. Please refer to the appropri-
ate timer type in Section 24.0 “Electrical
Characteristics”.
TMR5HLD
16
16
Write TMR4
Read TMR4
16
Reset
TMR5 TMR4 Sync
MSB LSB
Comparator x 32
Equal
PR5 PR4
0
T5IF
Event Flag
1 Q D TGATE (T4CON<6>)
TGATE
Q CK
TCS
TGATE
(T4CON<6>)
TCKPS<1:0>
TON 2
T4CK 1x
Prescaler
Gate
01 1, 8, 64, 256
Sync
TCY 00
Note: Timer Configuration bit T45, (T4CON<3>), must be set to ‘1’ for a 32-bit timer/counter operation. All
control bits are respective to the T4CON register.
PR4
Equal
Comparator x 16
TMR4 Sync
Reset
0
T4IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
TON 2
T4CK 1x
Gate Prescaler
Sync 01 1, 8, 64, 256
TCY 00
PR5
TMR5
Reset
0
T5IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
TON 2
Sync 1x
Prescaler
01 1, 8, 64, 256
TCY 00
Note: The dsPIC30F5015/5016 devices do not have an external pin input to Timer5. In these devices, the
following modes should not be used:
1. TCS = 1
2. TCS = 0 and TGATE = 1 (gated time accumulation)
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
dsPIC30F5015/5016
DS70149E-page 79
dsPIC30F5015/5016
NOTES:
16 16
ICx ICTMR
Pin 1 0
Edge FIFO
Prescaler Clock
Detection R/W
1, 4, 16 Synchronizer
Logic Logic
3 ICM<2:0> ICxBUF
Mode Select
ICBNE, ICOV
ICI<1:0>
Interrupt
ICxCON Logic
Note: Where ‘x’ is shown, reference is made to the registers or bits associated to the respective input
capture channels 1 through N.
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
IC1BUF 0140 Input 1 Capture Register uuuu uuuu uuuu uuuu
IC1CON 0142 — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC2CON 0146 — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC3CON 014A — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC4CON 014E — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F5015/5016
DS70149E-page 83
dsPIC30F5015/5016
NOTES:
OCxRS
3 Output Enable
OCM<2:0>
Comparator Mode Select OCFA
(for x = 1, 2, 3 or 4)
OCTSEL
0 1 0 1
Note: Where ‘x’ is shown, reference is made to the registers associated with the respective output compare
channels 1 through N.
13.3 Dual Output Compare Match Mode The user must perform the following steps in order to
configure the output compare module for PWM
When control bits OCM<2:0> (OCxCON<2:0>) = 100 operation:
or 101, the selected output compare channel is config-
1. Set the PWM period by writing to the appropriate
ured for one of two dual output compare modes, which
Period register.
are:
2. Set the PWM duty cycle by writing to the OCxRS
• Single Output Pulse mode register.
• Continuous Output Pulse mode 3. Configure the output compare module for PWM
operation.
13.3.1 SINGLE-PULSE MODE
4. Set the TMRx prescale value and enable the
For the user to configure the module for the generation timer, TON (TxCON<15>) = 1.
of a single output pulse, the following steps are
required (assuming timer is off): 13.4.1 INPUT PIN FAULT PROTECTION
• Determine instruction cycle time TCY. FOR PWM
• Calculate desired pulse width value based on TCY. When control bits OCM<2:0> (OCxCON<2:0>) = 111,
• Calculate time to start pulse from timer start value the selected output compare channel is again
of 0x0000. configured for the PWM mode of operation, with the
• Write pulse width start and stop times into OCxR additional feature of input Fault protection. While in this
and OCxRS Compare registers (x denotes mode, if a logic ‘0’ is detected on the OCFA pin, the
channel 1, 2, ...,N). respective PWM output pin is placed in the high-
impedance input state. The OCFLT bit (OCxCON<4>)
• Set Timer Period register to value equal to, or
indicates whether a Fault condition has occurred. This
greater than, value in OCxRS Compare register.
state will be maintained until both of the following
• Set OCM<2:0> = 100. events have occurred:
• Enable timer, TON (TxCON<15>) = 1.
• The external Fault condition has been removed.
To initiate another single pulse, issue another write to • The PWM mode has been re-enabled by writing
set OCM<2:0> = 100. to the appropriate control bits.
Duty Cycle
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
OC1RS 0180 Output Compare 1 Secondary Register 0000 0000 0000 0000
OC1R 0182 Output Compare 1 Main Register 0000 0000 0000 0000
OC1CON 0184 — — OCSIDL — — — — — — — — OCFLT OCTSEL OCM<2:0> 0000 0000 0000 0000
OC2RS 0186 Output Compare 2 Secondary Register 0000 0000 0000 0000
OC2R 0188 Output Compare 2 Main Register 0000 0000 0000 0000
OC2CON 018A — — OCSIDL — — — — — — — — OCFLT OCTSE OCM<2:0> 0000 0000 0000 0000
OC3RS 018C Output Compare 3 Secondary Register 0000 0000 0000 0000
OC3R 018E Output Compare 3 Main Register 0000 0000 0000 0000
OC3CON 0190 — — OCSIDL — — — — — — — — OCFLT OCTSEL OCM<2:0> 0000 0000 0000 0000
OC4RS 0192 Output Compare 4 Secondary Register 0000 0000 0000 0000
OC4R 0194 Output Compare 4 Main Register 0000 0000 0000 0000
OC4CON 0196 — — OCSIDL — — — — — — — — OCFLT OCTSEL OCM<2:0> 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F5015/5016
DS70149E-page 89
dsPIC30F5015/5016
NOTES:
1
QEIM<2:0>
0
QEIIF
D Q
TQGATE Event
CK Q Flag
Programmable
QEB
Digital Filter
Programmable
INDX
Digital Filter
3
PCDOUT
Note: Changing the operational mode (i.e., from 14.7.2 TIMER OPERATION DURING CPU
QEI to Timer or vice versa), will not affect IDLE MODE
the Timer/Position Count register contents.
When the CPU is placed in the Idle mode and the QEI
The UPDN control/Status bit (QEICON<11>) can be module is configured in the 16-bit Timer mode, the
used to select the count direction state of the Timer 16-bit timer will operate if the QEISIDL bit (QEI-
register. When UPDN = 1, the timer will count up. When CON<13>) = 0. This bit defaults to a logic ‘0’ upon
UPDN = 0, the timer will count down. executing POR and BOR. For halting the timer module
In addition, control bit, UDSRC (QEICON<0>), deter- during the CPU Idle mode, QEISIDL should be set
mines whether the timer count direction state is based to ‘1’.
on the logic state written into the UPDN control/Status If the QEISIDL bit is cleared, the timer will function
bit (QEICON<11>), or the QEB pin state. When normally, as if the CPU Idle mode had not been
entered.
SFR
Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
QEICON 0122 CNTERR — QEISIDL INDX UPDN QEIM<2:0> SWPAB PCDOUT TQGATE TQCKPS<1:0> POSRES TQCS UDSRC 0000 0000 0000 0000
DFLTCON 0124 — — — — — IMV<1:0> CEID QEOUT QECK2 QECK1 QECK0 — — — — 0000 0000 0000 0000
POSCNT 0126 Position Counter<15:0> 0000 0000 0000 0000
MAXCNT 0128 Maximun Count<15:0> 1111 1111 1111 1111
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F5015/5016
DS70149E-page 95
dsPIC30F5015/5016
NOTES:
PWMCON1
PWM Enable and Mode SFRs
PWMCON2
DTCON2
FLTBCON
PWM Manual
OVDCON
Control SFR
PWM Generator 4
PDC4 Buffer
16-bit Data Bus
PDC4
PWM PWM3H
PTMR Channel 3 Dead-Time
Generator 3 Output
Generator and
Override Logic PWM3L
Driver
Comparator
Block
PWM PWM2H
Generator 2 Channel 2 Dead-Time
Generator and
PTPER Override Logic PWM2L
PWM
Generator 1 Channel 1 Dead-Time PWM1H
Generator and
PTPER Buffer Override Logic PWM1L
PTCON FLTA
FLTB
SEVTCMP PTDIR
Note: Details of PWM Generator 1, 2 and 3 are not shown for clarity.
Period
Period
PWMxH
PWMxL
SFR Name Addr Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
PTCON 01C0 PTEN — PTSIDL — — — — — PTOPS<3:0> PTCKPS<1:0> PTMOD<1:0> 0000 0000 0000 0000
PTMR 01C2 PTDIR PWM Timer Count Value 0000 0000 0000 0000
PTPER 01C4 — PWM Time Base Period Register 0111 1111 1111 1111
SEVTCMP 01C6 SEVTDIR PWM Special Event Compare Register 0000 0000 0000 0000
PWMCON1 01C8 — — — — PTMOD4 PTMOD3 PTMOD2 PTMOD1 PEN4H PEN3H PEN2H PEN1H PEN4L PEN3L PEN2L PEN1L 0000 0000 1111 1111
PWMCON2 01CA — — — — SEVOPS<3:0> — — — — — IUE OSYNC UDIS 0000 0000 0000 0000
DTCON1 01CC DTBPS<1:0> Dead-Time B Value DTAPS<1:0> Dead-Time A Value 0000 0000 0000 0000
DTCON2 01CE — — — — — — — — DTS4A DTS4I DTS3A DTS3I DTS2A DTS2I DTS1A DTS1I 0000 0000 0000 0000
FLTACON 01D0 FAOV4H FAOV4L FAOV3H FAOV3L FAOV2H FAOV2L FAOV1H FAOV1L FLTAM — — — FAEN4 FAEN3 FAEN2 FAEN1 0000 0000 0000 0000
FLTBCON 01D2 FBOV4H FBOV4L FBOV3H FBOV3L FBOV2H FBOV2L FBOV1H FBOV1L FLTBM — — — FBEN4 FBEN3 FBEN2 FBEN1 0000 0000 0000 0000
OVDCON 01D4 POVD4H POVD4L POVD3H POVD3L POVD2H POVD2L POVD1H POVD1L POUT4H POUT4L POUT3H POUT3L POUT2H POUT2L POUT1H POUT1L 1111 1111 0000 0000
PDC1 01D6 PWM Duty Cycle 1 Register 0000 0000 0000 0000
PDC2 01D8 PWM Duty Cycle 2 Register 0000 0000 0000 0000
PDC3 01DA PWM Duty Cycle 3 Register 0000 0000 0000 0000
PDC4 01DC PWM Duty Cycle 4 Register 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F5015/5016
DS70149E-page 107
dsPIC30F5015/5016
NOTES:
Internal
Data Bus
Read Write
SPIxBUF SPIxBUF
Receive Transmit
SPIxSR
SDIx bit 0
SDOx Shift
clock
SS and FSYNC Clock Edge
Control Control Select
SSx
Secondary Primary
Prescaler Prescaler FCY
1:1-1:8 1, 4, 16, 64
SCKx
Note: x = 1 or 2.
Note: x = 1 or 2, y = 1 or 2.
dsPIC30F5015/5016
SFR
Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
SPI1STAT 0220 SPIEN — SPISIDL — — — — — — SPIROV — — — — SPITBF SPIRBF 0000 0000 0000 0000
SPI1CON 0222 — FRMEN SPIFSD — DISSDO MODE16 SMP CKE SSEN CKP MSTEN SPRE2 SPRE1 SPRE0 PPRE1 PPRE0 0000 0000 0000 0000
SPI1BUF 0224 Transmit and Receive Buffer 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
SPI2STAT 0226 SPIEN — SPISIDL — — — — — — SPIROV — — — — SPITBF SPIRBF 0000 0000 0000 0000
SPI2CON 0228 — FRMEN SPIFSD — DISSDO MODE16 SMP CKE SSEN CKP MSTEN SPRE2 SPRE1 SPRE0 PPRE1 PPRE0 0000 0000 0000 0000
SPI2BUF 022A Transmit and Receive Buffer 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2011 Microchip Technology Inc.
dsPIC30F5015/5016
17.0 I2C™ MODULE Thus, the I2C module can operate either as a slave or
a master on an I2C bus.
Note: This data sheet summarizes features of
this group of dsPIC30F devices and is not 17.1.1 VARIOUS I2C MODES
intended to be a complete reference The following types of I2C operation are supported:
source. For more information on the CPU,
peripherals, register descriptions and • I2C Slave operation with 7-bit addressing
general device functionality, refer to the • I2C Slave operation with 10-bit addressing
“dsPIC30F Family Reference Manual” • I2C Master operation with 7-bit or 10-bit addressing
(DS70046). For more information on the See the I2C programmer’s model in Figure 17-1.
device instruction set and programming,
refer to the “16-bit MCU and DSC 17.1.2 PIN CONFIGURATION IN I2C MODE
Programmer’s Reference Manual”
(DS70157). I2C has a 2-pin interface; pin SCL is clock and pin SDA
is data.
The Inter-Integrated Circuit (I2C™) module provides
complete hardware support for both Slave and Multi- 17.1.3 I2C REGISTERS
Master modes of the I2C serial communication I2CCON and I2CSTAT are control and status registers,
standard, with a 16-bit interface. respectively. The I2CCON register is readable and writ-
This module offers the following key features: able. The lower 6 bits of I2CSTAT are read-only. The
remaining bits of the I2CSTAT are read/write.
• I2C interface supporting both Master and Slave
operation. I2CRSR is the Shift register used for shifting data,
• I2C Slave mode supports 7-bit and 10-bit whereas I2CRCV is the Buffer register to which data
addressing. bytes are written, or from which data bytes are read.
I2CRCV is the Receive buffer, as shown in Figure 16-1.
• I2C Master mode supports 7-bit and 10-bit
I2CTRN is the Transmit register to which bytes are writ-
addressing.
ten during a transmit operation, as shown in Figure 16-2.
• I2C port allows bidirectional transfers between
master and slaves. The I2CADD register holds the slave address. A Status
bit, ADD10, indicates 10-bit Address mode. The
• Serial clock synchronization for I2C port can be
I2CBRG acts as the Baud Rate Generator (BRG)
used as a handshake mechanism to suspend and
reload value.
resume serial transfer (SCLREL control).
• I2C supports Multi-Master operation; detects bus In receive operations, I2CRSR and I2CRCV together
collision and will arbitrate accordingly. form a double-buffered receiver. When I2CRSR receives
a complete byte, it is transferred to I2CRCV and an inter-
rupt pulse is generated. During transmission, the
17.1 Operating Function Description I2CTRN is not double-buffered.
The hardware fully implements all the master and slave Note: Following a Restart condition in 10-bit
functions of the I2C Standard and Fast mode mode, the user only needs to match the
specifications, as well as 7 and 10-bit addressing. first 7-bit address.
I2CRCV (8 bits)
bit 7 bit 0
I2CTRN (8 bits)
bit 7 bit 0
I2CBRG (9 bits)
bit 8 bit 0
I2CCON (16 bits)
bit 15 bit 0
I2CSTAT (16 bits)
bit 15 bit 0
I2CADD (10 bits)
bit 9 bit 0
Internal
Data Bus
I2CRCV
Read
Shift
SCL Clock
I2CRSR
LSB
SDA Addr_Match
Match Detect
Write
I2CADD
Read
Start and
Stop bit Detect
Write
I2CSTAT
Start, Restart,
Stop bit Generate
Read
Control Logic
Collision
Detect
Write
I2CCON
Acknowledge
Read
Generation
Clock
Stretching Write
I2CTRN
Shift LSB Read
Clock
Reload
Control Write
17.3 I2C 7-bit Slave Mode Operation The A10M bit is a control bit that signifies that the
address in I2CADD is a 10-bit address rather than a
Once enabled (I2CEN = 1), the slave module will wait 7-bit address. The address detection protocol for the
for a Start bit to occur (i.e., the I2C module is ‘Idle’). first byte of a message address is identical for 7-bit
Following the detection of a Start bit, 8 bits are shifted and 10-bit messages, but the bits being compared are
into I2CRSR and the address is compared against different.
I2CADD. In 7-bit mode (A10M = 0), bits I2CADD<6:0>
I2CADD holds the entire 10-bit address. Upon receiv-
are compared against I2CRSR<7:1> and I2CRSR<0>
ing an address following a Start bit, I2CRSR <7:3> is
is the R_W bit. All incoming bits are sampled on the
compared against a literal ‘11110’ (the default 10-bit
rising edge of SCL.
address) and I2CRSR<2:1> are compared against
If an address match occurs, an Acknowledgement will I2CADD<9:8>. If a match occurs and if R_W = 0, the
be sent, and the Slave Event Interrupt Flag (SI2CIF) is interrupt pulse is sent. The ADD10 bit will be cleared to
set on the falling edge of the ninth (ACK) bit. The indicate a partial address match. If a match fails or
address match does not affect the contents of the R_W = 1, the ADD10 bit is cleared and the module
I2CRCV buffer or the RBF bit. returns to the Idle state.
The low byte of the address is then received and com-
17.3.1 SLAVE TRANSMISSION
pared with I2CADD<7:0>. If an address match occurs,
If the R_W bit received is a ‘1’, then the serial port will the interrupt pulse is generated and the ADD10 bit is
go into Transmit mode. It will send ACK on the ninth bit set, indicating a complete 10-bit address match. If an
and then hold SCL to ‘0’ until the CPU responds by address match did not occur, the ADD10 bit is cleared
writing to I2CTRN. SCL is released by setting the and the module returns to the Idle state.
SCLREL bit, and 8 bits of data are shifted out. Data bits
are shifted out on the falling edge of SCL, such that
SDA is valid during SCL high (see timing diagram). The
interrupt pulse is sent on the falling edge of the ninth
clock pulse, regardless of the status of the ACK
received from the master.
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
dsPIC30F5015/5016
DS70149E-page 119
dsPIC30F5015/5016
NOTES:
Write Write
– Control TSR
– Control Buffer
– Generate Flags
– Generate Interrupt
Load TSR
UxTXIF
UTXBRK
Data
Transmit Shift Register (UxTSR)
‘0’ (Start)
UxTX
‘1’ (Stop)
Control
Signals
Note: x = 1.
UxMODE UxSTA
LPBACK 8-9
From UxTX
1 Load RSR
to Buffer Control
FERR
PERR
Receive Shift Register Signals
UxRX
0 (UxRSR)
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
U1MODE 020C UARTEN — USIDL — — — — — WAKE LPBACK ABAUD — — PDSEL1 PDSEL0 STSEL 0000 0000 0000 0000
U1STA 020E UTXISEL — — — UTXBRK UTXEN UTXBF TRMT URXISEL1 URXISEL0 ADDEN RIDLE PERR FERR OERR URXDA 0000 0001 0001 0000
U1TXREG 0210 — — — — — — — UTX8 Transmit Register 0000 000u uuuu uuuu
U1RXREG 0212 — — — — — — — URX8 Receive Register 0000 0000 0000 0000
U1BRG 0214 Baud Rate Generator Prescaler 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F5015/5016
DS70149E-page 127
dsPIC30F5015/5016
NOTES:
Acceptance Mask
BUFFERS RXM1
Acceptance Filter
RXF2
MESSAGE
MESSAGE
MTXBUFF
MTXBUFF
MTXBUFF
MSGREQ
MSGREQ
MSGREQ
TXLARB
TXLARB
TXLARB
c RXF0 RXF4 p
TXERR
TXERR
TXERR
TXABT
TXABT
TXABT
e t
Acceptance Filter Acceptance Filter
p
RXF1 RXF5
t
R R
X Identifier M Identifier X
Message B A B
Queue 0 B 1
Control
Transmit Byte Sequencer Data Field Data Field
Receive RERRCNT
Error
Counter
PROTOCOL TERRCNT
Protocol
Finite
CRC Generator CRC Check
State
Machine
Bit
Transmit
Timing Bit Timing
Logic
Logic Generator
CiTX(1) CiRX(1)
Input Signal
Sample Point
TQ
19.6.6 SYNCHRONIZATION
19.6.3 PROPAGATION SEGMENT
To compensate for phase shifts between the oscillator
This part of the bit time is used to compensate physical frequencies of the different bus stations, each CAN
delay times within the network. These delay times con- controller must be able to synchronize to the relevant
sist of the signal propagation time on the bus line and signal edge of the incoming signal. When an edge in
the internal delay time of the nodes. The Propagation the transmitted data is detected, the logic will compare
Segment can be programmed from 1 TQ to 8 TQ by the location of the edge to the expected time (Synchro-
setting the PRSEG<2:0> bits (CiCFG2<2:0>). nous Segment). The circuit will then adjust the values
of Phase1 Seg and Phase2 Seg. There are two
19.6.4 PHASE SEGMENTS
mechanisms used to synchronize.
The phase segments are used to optimally locate the
sampling of the received bit within the transmitted bit 19.6.6.1 Hard Synchronization
time. The sampling point is between Phase1 Seg and Hard Synchronization is only done whenever there is a
Phase2 Seg. These segments are lengthened or short- ‘recessive’ to ‘dominant’ edge during Bus Idle, indicat-
ened by resynchronization. The end of the Phase1 Seg ing the start of a message. After hard synchronization,
determines the sampling point within a bit period. The the bit time counters are restarted with the Synchro-
segment is programmable from 1 TQ to 8 TQ. Phase2 nous Segment. Hard synchronization forces the edge
Seg provides delay to the next transmitted data transi- which has caused the hard synchronization to lie within
tion. The segment is programmable from 1 TQ to 8 TQ, the synchronization segment of the restarted bit time. If
or it may be defined to be equal to the greater of a hard synchronization is done, there will not be a
Phase1 Seg or the Information Processing Time resynchronization within that bit time.
(2 TQ). The Phase1 Seg is initialized by setting bits
SEG1PH<2:0> (CiCFG2<5:3>) and Phase2 Seg is 19.6.6.2 Resynchronization
initialized by setting SEG2PH<2:0> (CiCFG2<10:8>).
As a result of resynchronization, Phase1 Seg may be
The following requirement must be fulfilled while setting lengthened or Phase2 Seg may be shortened. The
the lengths of the Phase Segments: amount of lengthening or shortening of the phase
Propagation Segment + Phase1 Seg > = Phase2 buffer segment has an upper bound known as the
Seg synchronization jump width, and is specified by the
SJW<1:0> bits (CiCFG1<7:6>). The value of the
synchronization jump width will be added to Phase1
Seg or subtracted from Phase2 Seg. The
resynchronization jump width is programmable
between 1 TQ and 4 TQ.
The following requirement must be fulfilled while setting
the SJW<1:0> bits:
Phase2 Seg > Synchronization Jump Width
dsPIC30F5015/5016
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
C1RXF0SID 0300 — — — Receive Acceptance Filter 0 Standard Identifier<10:0> — EXIDE 000u uuuu uuuu uu0u
C1RXF0EIDH 0302 — — — — Receive Acceptance Filter 0 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXF0EIDL 0304 Receive Acceptance Filter 0 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1RXF1SID 0308 — — — Receive Acceptance Filter 1 Standard Identifier<10:0> — EXIDE 000u uuuu uuuu uu0u
C1RXF1EIDH 030A — — — — Receive Acceptance Filter 1 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXF1EIDL 030C Receive Acceptance Filter 1 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1RXF2SID 0310 — — — Receive Acceptance Filter 2 Standard Identifier<10:0> — EXIDE 000u uuuu uuuu uu0u
C1RXF2EIDH 0312 — — — — Receive Acceptance Filter 2 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXF2EIDL 0314 Receive Acceptance Filter 2 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1RXF3SID 0318 — — — Receive Acceptance Filter 3 Standard Identifier <10:0> — EXIDE 000u uuuu uuuu uu0u
C1RXF3EIDH 031A — — — — Receive Acceptance Filter 3 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXF3EIDL 031C Receive Acceptance Filter 3 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1RXF4SID 0320 — — — Receive Acceptance Filter 4 Standard Identifier<10:0> — EXIDE 000u uuuu uuuu uu0u
C1RXF4EIDH 0322 — — — — Receive Acceptance Filter 4 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXF4EIDL 0324 Receive Acceptance Filter 4 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1RXF5SID 0328 — — — Receive Acceptance Filter 5 Standard Identifier<10:0> — EXIDE 000u uuuu uuuu uu0u
C1RXF5EIDH 032A — — — — Receive Acceptance Filter 5 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXF5EIDL 032C Receive Acceptance Filter 5 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1RXM0SID 0330 — — — Receive Acceptance Mask 0 Standard Identifier<10:0> — MIDE 000u uuuu uuuu uu0u
C1RXM0EIDH 0332 — — — — Receive Acceptance Mask 0 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXM0EIDL 0334 Receive Acceptance Mask 0 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1RXM1SID 0338 — — — Receive Acceptance Mask 1 Standard Identifier<10:0> — MIDE 000u uuuu uuuu uu0u
C1RXM1EIDH 033A — — — — Receive Acceptance Mask 1 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RXM1EIDL 033C Receive Acceptance Mask 1 Extended Identifier<5:0> — — — — — — — — — — uuuu uu00 0000 0000
C1TX2SID 0340 Transmit Buffer 2 Standard Identifier <10:6> — — — Transmit Buffer 2 Standard Identifier<5:0> SRR TXIDE uuuu u000 uuuu uuuu
C1TX2EID 0342 Transmit Buffer 2 Extended Identifier<17:14> — — — — Transmit Buffer 2 Extended Identifier<13:6> uuuu 0000 uuuu uuuu
C1TX2DLC 0344 Transmit Buffer 2 Extended Identifier<5:0> TXRTR TXRB1 TXRB0 DLC<3:0> — — — uuuu uuuu uuuu u000
C1TX2B1 0346 Transmit Buffer 2 Byte 1 Transmit Buffer 2 Byte 0 uuuu uuuu uuuu uuuu
C1TX2B2 0348 Transmit Buffer 2 Byte 3 Transmit Buffer 2 Byte 2 uuuu uuuu uuuu uuuu
© 2011 Microchip Technology Inc.
C1TX2B3 034A Transmit Buffer 2 Byte 5 Transmit Buffer 2 Byte 4 uuuu uuuu uuuu uuuu
C1TX2B4 034C Transmit Buffer 2 Byte 7 Transmit Buffer 2 Byte 6 uuuu uuuu uuuu uuuu
C1TX2CON 034E — — — — — — — — — TXABT TXLARB TXERR TXREQ — TXPRI<1:0> 0000 0000 0000 0000
C1TX1SID 0350 Transmit Buffer 1 Standard Identifier<10:6> — — — Transmit Buffer 1 Standard Identifier<5:0> SRR TXIDE uuuu u000 uuuu uuuu
C1TX1EID 0352 Transmit Buffer 1 Extended Identifier<17:14> — — — — Transmit Buffer 1 Extended Identifier<13:6> uuuu 0000 uuuu uuuu
C1TX1DLC 0354 Transmit Buffer 1 Extended Identifier<5:0> TXRTR TXRB1 TXRB0 DLC<3:0> — — — uuuu uuuu uuuu u000
C1TX1B1 0356 Transmit Buffer 1 Byte 1 Transmit Buffer 1 Byte 0 uuuu uuuu uuuu uuuu
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 19-1: CAN1 REGISTER MAP(1) (CONTINUED)
© 2011 Microchip Technology Inc.
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
C1TX1B2 0358 Transmit Buffer 1 Byte 3 Transmit Buffer 1 Byte 2 uuuu uuuu uuuu uuuu
C1TX1B3 035A Transmit Buffer 1 Byte 5 Transmit Buffer 1 Byte 4 uuuu uuuu uuuu uuuu
C1TX1B4 035C Transmit Buffer 1 Byte 7 Transmit Buffer 1 Byte 6 uuuu uuuu uuuu uuuu
C1TX1CON 035E — — — — — — — — — TXABT TXLARB TXERR TXREQ — TXPRI<1:0> 0000 0000 0000 0000
C1TX0SID 0360 Transmit Buffer 0 Standard Identifier<10:6> — — — Transmit Buffer 0 Standard Identifier<5:0> SRR TXIDE uuuu u000 uuuu uuuu
C1TX0EID 0362 Transmit Buffer 0 Extended Identifier<17:14> — — — — Transmit Buffer 0 Extended Identifier<13:6> uuuu 0000 uuuu uuuu
C1TX0DLC 0364 Transmit Buffer 0 Extended Identifier<5:0> TXRTR TXRB1 TXRB0 DLC<3:0> — — — uuuu uuuu uuuu u000
C1TX0B1 0366 Transmit Buffer 0 Byte 1 Transmit Buffer 0 Byte 0 uuuu uuuu uuuu uuuu
C1TX0B2 0368 Transmit Buffer 0 Byte 3 Transmit Buffer 0 Byte 2 uuuu uuuu uuuu uuuu
C1TX0B3 036A Transmit Buffer 0 Byte 5 Transmit Buffer 0 Byte 4 uuuu uuuu uuuu uuuu
C1TX0B4 036C Transmit Buffer 0 Byte 7 Transmit Buffer 0 Byte 6 uuuu uuuu uuuu uuuu
C1TX0CON 036E — — — — — — — — — TXABT TXLARB TXERR TXREQ — TXPRI<1:0> 0000 0000 0000 0000
C1RX1SID 0370 — — — Receive Buffer 1 Standard Identifier<10:0> SRR RXIDE 000u uuuu uuuu uuuu
C1RX1EID 0372 — — — — Receive Buffer 1 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
C1RX1DLC 0374 Receive Buffer 1 Extended Identifier<5:0> RXRTR RXRB1 — — — RXRB0 DLC<3:0> uuuu uuuu 000u uuuu
C1RX1B1 0376 Receive Buffer 1 Byte 1 Receive Buffer 1 Byte 0 uuuu uuuu uuuu uuuu
C1RX1B2 0378 Receive Buffer 1 Byte 3 Receive Buffer 1 Byte 2 uuuu uuuu uuuu uuuu
C1RX1B3 037A Receive Buffer 1 Byte 5 Receive Buffer 1 Byte 4 uuuu uuuu uuuu uuuu
C1RX1B4 037C Receive Buffer 1 Byte 7 Receive Buffer 1 Byte 6 uuuu uuuu uuuu uuuu
C1RX1CON 037E — — — — — — — — RXFUL — — — RXRTRRO FILHIT<2:0> 0000 0000 0000 0000
C1RX0SID 0380 — — — Receive Buffer 0 Standard Identifier<10:0> SRR RXIDE 000u uuuu uuuu uuuu
C1RX0EID 0382 — — — — Receive Buffer 0 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
dsPIC30F5015/5016
C1RX0DLC 0384 Receive Buffer 0 Extended Identifier<5:0> RXRTR RXRB1 — — — RXRB0 DLC<3:0> uuuu uuuu 000u uuuu
C1RX0B1 0386 Receive Buffer 0 Byte 1 Receive Buffer 0 Byte 0 uuuu uuuu uuuu uuuu
C1RX0B2 0388 Receive Buffer 0 Byte 3 Receive Buffer 0 Byte 2 uuuu uuuu uuuu uuuu
C1RX0B3 038A Receive Buffer 0 Byte 5 Receive Buffer 0 Byte 4 uuuu uuuu uuuu uuuu
C1RX0B4 038C Receive Buffer 0 Byte 7 Receive Buffer 0 Byte 6 uuuu uuuu uuuu uuuu
C1RX0CON 038E — — — — — — — — RXFUL — — — RXRTRRO DBEN JTOFF FILHIT0 0000 0000 0000 0000
C1CTRL 0390 CANCAP — CSIDLE ABAT CANCKS REQOP<2:0> OPMODE<2:0> — ICODE<2:0> — 0000 0100 1000 0000
C1CFG1 0392 — — — — — — — — SJW<1:0> BRP<5:0> 0000 0000 0000 0000
C1CFG2 0394 — WAKFIL — — — SEG2PH<2:0> SEG2PHTS SAM SEG1PH<2:0> PRSEG<2:0> 0u00 0uuu uuuu uuuu
C1INTF 0396 RX0OVR RX1OVR TXBO TXEP RXEP TXWAR RXWAR EWARN IVRIF WAKIF ERRIF TX2IF TX1IF TX0IF RX1IF RX0IF 0000 0000 0000 0000
C1INTE 0398 — — — — — — — — IVRIE WAKIE ERRIE TX2IE TX1IE TX0IE RX1E RX0IE 0000 0000 0000 0000
C1EC 039A Transmit Error Count Register Receive Error Count Register 0000 0000 0000 0000
DS70149E-page 137
AVDD
VREF+(1)
AVSS
VREF-(2)
AN0 AN0
AN3 +
S/H CH1 ADC
AN6 -
AN9
Format
Data
AN7 -
AN10 16-word, 10-bit
Dual Port
Buffer
Bus Interface
AN2 AN2
AN5 +
S/H CH3
AN8 - CH1,CH2,
AN11 CH3,CH0 Sample/Sequence
Sample Control
AN0
AN1 Input
AN2 Switches Input MUX
AN3 AN3 Control
AN4 AN4
AN5 AN5
AN6 AN6
AN7 AN7
AN8 AN8
AN9 AN9
AN10 AN10
AN11 AN11
AN12 AN12
AN13 AN13
AN14 AN14
AN15 AN15 +
S/H CH0
AN1 -
ANx CHX
S/H ADC
ANx CHX
S/H ADC
ANx or VREF-
ANx CHX
S/H ADC
ANx or VREF-
Note 1: External VREF- and VREF+ pins must be used for correct operation. See Figure 20-2 for recommended
circuit.
VDD
64
63
62
61
60
59
58
55
54
53
52
51
50
49
VDD
VSS
1 48
2 47
3 46 VDD VDD VDD
4 45
5 44 C8 C7 C6
1 mF 0.1 mF 0.01 mF
6 43
MCLR 42
8 dsPIC30F5015 VSS
VDD VSS 40
VDD 39 VDD
11 VDD
12 37 VDD VDD VDD
VDD R1 13 36
10 35 C5 C4 C3
R2 14
1 mF 0.1 mF 0.01 mF
10 VREF- 34
VREF+ 33
AVDD
AVSS
C2 C1
VDD
VSS
17
18
21
22
23
24
27
28
29
30
31
32
0.1 μF 0.01 μF
AVDD VDD
CHOLD
VA CPIN I leakage = DAC capacitance
VT = 0.6V ± 500 nA = 4.4 pF
VSS
Note: CPIN value depends on device package and is not tested. Effect of CPIN negligible if Rs ≤5 kΩ.
RAM Contents: d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Read to Bus:
Signed Fractional (1.15) d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0 0 0
Fractional (1.15) d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0 0 0
Signed Integer d09 d09 d09 d09 d09 d09 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Integer 0 0 0 0 0 0 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
dsPIC30F5015/5016
ADPCFG 02A8 PCFG15 PCFG14 PCFG13 PCFG12 PCFG11 PCFG10 PCFG9 PCFG8 PCFG7 PCFG6 PCFG5 PCFG4 PCFG3 PCFG2 PCFG1 PCFG0 0000 0000 0000 0000
ADCSSL 02AA CSSL15 CSSL14 CSSL13 CSSL12 CSSL11 CSSL10 CSSL9 CSSL8 CSSL7 CSSL6 CSSL5 CSSL4 CSSL3 CSSL2 CSSL1 CSSL0 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70149E-page 149
dsPIC30F5015/5016
NOTES:
Wake-up Request
FPLL
OSC1
Primary PLL
Oscillator x4, x8, x16 PLL
OSC2
Lock COSC<1:0>
Posc
TUN<4:0> NOSC<1:0>
5
Primary
Oscillator OSWEN
Stability Detector
Internal Fast RC
Oscillator (FRC)
Oscillator
POR Done Start-up
Clock
Timer
Switching
Programmable
Sosc and Control Clock Divider System
Block
Clock
SOSCO
Secondary 2
32 kHz LP
Oscillator
SOSCI Oscillator
Stability Detector POST<1:0>
Internal LPRC
Low-Power RC
Oscillator (LPRC)
CF
Fail-Safe Clock
FCKSM<1:0> Monitor (FSCM)
2 Oscillator Trap
to Timer1
Digital
Glitch Filter
MCLR
Sleep or Idle
WDT
Module
VDD
MCLR
Internal POR
TOST
OST Time-out
TPWRT
PWRT Time-out
Internal Reset
FIGURE 21-4: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 1
VDD
MCLR
Internal POR
TOST
OST Time-out
TPWRT
PWRT Time-out
Internal Reset
FIGURE 21-5: TIME-OUT SEQUENCE ON POWER-UP (MCLR NOT TIED TO VDD): CASE 2
VDD
MCLR
Internal POR
TOST
OST Time-out
TPWRT
PWRT Time-out
Internal Reset
21.3.1.2 Operating without FSCM and PWRT FIGURE 21-6: EXTERNAL POWER-ON
If the FSCM is disabled and the Power-up Timer RESET CIRCUIT (FOR
(PWRT) is also disabled, then the device will exit rap- SLOW VDD POWER-UP)
idly from Reset on power-up. If the clock source is VDD
FRC, LPRC, EXTRC or EC, it will be active
immediately. D R
If the FSCM is disabled and the system clock has not R1
MCLR
started, the device will be in a frozen state at the Reset
vector until the system clock starts. From the user’s C dsPIC30F
perspective, the device will appear to be in Reset until
a system clock is available.
Note 1: External Power-on Reset circuit is
21.3.2 BOR: PROGRAMMABLE required only if the VDD power-up slope
BROWN-OUT RESET is too slow. The diode D helps discharge
the capacitor quickly when VDD powers
The BOR (Brown-out Reset) module is based on an down.
internal voltage reference circuit. The main purpose of
the BOR module is to generate a device Reset when 2: R should be suitably chosen so as to
a brown-out condition occurs. Brown-out conditions make sure that the voltage drop across
are generally caused by glitches on the AC mains R does not violate the device’s electrical
(i.e., missing portions of the AC cycle waveform due specification.
to bad power transmission lines or voltage sags due 3: R1 should be suitably chosen so as to
to excessive current draw when a large inductive load limit any current flowing into MCLR from
is turned on). external capacitor C, in the event of
The BOR module allows selection of one of the MCLR/VPP pin breakdown due to Elec-
following voltage trip points: trostatic Discharge (ESD) or Electrical
Overstress (EOS).
• 2.6V-2.71V
• 4.1V-4,4V
• 4.58V-4.73V Note: Dedicated supervisory devices, such as
the MCP1XX and MCP8XX, may also be
Note: The BOR voltage trip points indicated here
used as an external Power-on Reset
are nominal values provided for design
circuit.
guidance only.
The Watchdog Timer can be “enabled” or “disabled” Note: If a POR or BOR occurred, the selection of
only through a Configuration bit (FWDTEN) in the the oscillator is based on the FOS<2:0>
Configuration register FWDT. and FPR<4:0> Configuration bits.
Setting FWDTEN = 1 enables the Watchdog Timer. If the clock source is an oscillator, the clock to the
The enabling is done when programming the device. device is held off until OST times out (indicating a sta-
By default, after chip-erase, FWDTEN bit = 1. Any ble oscillator). If PLL is used, the system clock is held
device programmer capable of programming off until LOCK = 1 (indicating that the PLL is stable).
dsPIC30F devices allows programming of this and Either way, TPOR, TLOCK and TPWRT delays are applied.
other Configuration bits. If EC, FRC, LPRC or EXTRC oscillators are used, then
If enabled, the WDT will increment until it overflows or a delay of TPOR (~10 μs) is applied. This is the smallest
“times out”. A WDT time-out will force a device Reset delay possible on wake-up from Sleep.
(except during Sleep). To prevent a WDT time-out, the Moreover, if LP oscillator was active during Sleep, and
user must clear the Watchdog Timer using a CLRWDT LP is the oscillator used on wake-up, then the start-up
instruction. delay will be equal to TPOR. PWRT delay and OST
If a WDT times out during Sleep, the device will wake- timer delay are not applied. In order to have the small-
up. The WDTO bit in the RCON register will be cleared est possible start-up delay when waking up from Sleep,
to indicate a wake-up resulting from a WDT time-out. one of these faster wake-up options should be selected
Setting FWDTEN = 0 allows user software to enable/ before entering Sleep.
disable the Watchdog Timer via the SWDTEN Any interrupt that is individually enabled (using the
(RCON<5>) control bit. corresponding IE bit) and meets the prevailing priority
level will be able to wake-up the processor. The proces-
21.5 Power-Saving Modes sor will process the interrupt and branch to the ISR. The
Sleep Status bit in RCON register is set upon wake-up.
There are two power-saving states, Sleep and Idle,
that can be entered through the execution of a special Note: In spite of various delays applied (TPOR,
instruction, PWRSAV. TLOCK and TPWRT), the crystal oscillator
The format of the PWRSAV instruction is as follows: (and PLL) may not be active at the end of
the time-out (e.g., for low frequency crys-
PWRSAV <parameter>, where ‘parameter’ defines tals. In such cases), if FSCM is enabled,
Idle or Sleep mode. then the device will detect this as a clock
failure and process the clock failure trap,
21.5.1 SLEEP MODE the FRC oscillator will be enabled, and the
In Sleep mode, the clock to the CPU and peripherals is user will have to re-enable the crystal oscil-
shutdown. If an on-chip oscillator is being used, it is lator. If FSCM is not enabled, then the
shutdown. device will simply suspend execution of
The Fail-Safe Clock Monitor is not functional during code until the clock is stable, and will
Sleep, since there is no clock to monitor. However, remain in Sleep until the oscillator clock has
LPRC clock remains active if WDT is operational during started.
Sleep. All Resets will wake-up the processor from Sleep
The Brown-out protection circuit, if enabled, will remain mode. Any Reset, other than POR, will set the Sleep
functional during Sleep. Status bit. In a POR, the Sleep bit is cleared.
If Watchdog Timer is enabled, then the processor will
wake-up from Sleep mode upon WDT time-out. The
Sleep and WDTO Status bits are both set.
dsPIC30F5015/5016
SFR
Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
RCON 0740 TRAPR IOPUWR BGST — — — — — EXTR SWR SWDTEN WDTO SLEEP IDLE BOR POR Depends on type of Reset.
OSCCON 0742 — COSC<2:0> — NOSC<2:0> POST<1:0> LOCK — CF — LPOSCEN OSWEN Depends on Configuration bits.
OSCTUN 0744 — — — — — — — — — — — TUN<4:0> 0000 0000 0000 0000
PMD1 0770 T5MD T4MD T3MD T2MD T1MD QEIMD PWMMD — I2CMD U2MD U1MD SPI2MD SPI1MD — C1MD ADCMD 0000 0000 0000 0000
PMD2 0772 — — — —
IC4MD IC3MD IC2MD IC1MD — — — — OC4MD OC3MD OC2MD OC1MD 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
†NOTICE:
Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at those or any other conditions above those
indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for
extended periods may affect device reliability.
VDD
Load Condition 1 – for all pins except OSC2 Load Condition 2 – for OSC2
VDD/2
RL Pin CL
VSS
CL
Pin RL = 464Ω
CL = 50 pF for all pins except OSC2
VSS 5 pF for OSC2 output
Q4 Q1 Q2 Q3 Q4 Q1
OSC1
OS20
OS30 OS30 OS31 OS31
OS25
CLKO
OS40 OS41
Param
Characteristic Min Typ(1) Max Units Conditions
No.
OS61 x4 PLL — 0.251 0.413 % -40°C ≤TA ≤+85°C VDD = 3.0 to 3.6V
— 0.251 0.413 % -40°C ≤TA ≤+125°C VDD = 3.0 to 3.6V
— 0.256 0.47 % -40°C ≤TA ≤+85°C VDD = 4.5 to 5.5V
— 0.256 0.47 % -40°C ≤TA ≤+125°C VDD = 4.5 to 5.5V
x8 PLL — 0.355 0.584 % -40°C ≤TA ≤+85°C VDD = 3.0 to 3.6V
— 0.355 0.584 % -40°C ≤TA ≤+125°C VDD = 3.0 to 3.6V
— 0.362 0.664 % -40°C ≤TA ≤+85°C VDD = 4.5 to 5.5V
— 0.362 0.664 % -40°C ≤TA ≤+125°C VDD = 4.5 to 5.5V
x16 PLL — 0.67 0.92 % -40°C ≤TA ≤+85°C VDD = 3.0 to 3.6V
— 0.632 0.956 % -40°C ≤TA ≤+85°C VDD = 4.5 to 5.5V
— 0.632 0.956 % -40°C ≤TA ≤+125°C VDD = 4.5 to 5.5V
Note 1: These parameters are characterized but not tested in manufacturing.
Param
Characteristic Min Typ Max Units Conditions
No.
Internal FRC Accuracy @ FRC Freq. = 7.37 MHz(1)
OS63 FRC — — ±2.00 % -40°C ≤TA ≤+85°C VDD = 3.0-5.5V
— — ±5.00 % -40°C ≤TA ≤+125°C VDD = 3.0-5.5V
Note 1: Frequency is calibrated to 7.37 MHz (±2%) at 25°C and 5V. TUN bits can be used to compensate for
temperature drift.
I/O Pin
(Input)
DI35
DI40
VDD SY12
MCLR
Internal SY10
POR
SY11
PWRT
Time-out
SY30
OSC
Time-out
Internal
Reset
Watchdog
Timer
Reset
SY20
SY13
SY13
I/O Pins
SY35
FSCM
Delay
VBGAP
0V
TxCK
Tx10 Tx11
Tx15 Tx20
OS60
TMRX
QEB
TQ10 TQ11
TQ15 TQ20
POSCNT
ICX
IC10 IC11
IC15
OCx
(Output Compare
or PWM Mode) OC11 OC10
OC20
OCFA/OCFB
OC15
OCx
MP30
FLTA/B
MP20
PWMx
MP11 MP10
PWMx
TQ36
QEA
(input)
TQ31 TQ30
TQ35
QEB
(input) TQ41 TQ40
TQ31 TQ30
TQ35
QEB
Internal
QEA
(input)
QEB
(input)
Ungated
Index TQ50
TQ51
Index Internal
TQ55
Position Coun-
SCKx
(CKP = 0)
SCKx
(CKP = 1)
SP31 SP30
SP40 SP41
SP36
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP35
SP20 SP21
SP40 SP30,SP31
SP41
SSX
SP50 SP52
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP72 SP73
SP35
SP30,SP31 SP51
SP41
SP40
Note: Refer to Figure 24-2 for load conditions.
SP50 SP52
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP35
SP72 SP73
SP52
SP30,SP31 SP51
SDIX
MSb IN BIT14 - - - -1 LSb IN
SP41
SP40
SCL
IM31 IM34
IM30 IM33
SDA
Start Stop
Condition Condition
SDA
Out
SCL
IS31 IS34
IS30 IS33
SDA
Start Stop
Condition Condition
SDA
Out
CA10 CA11
CXRX Pin
(input)
CA20
AD50
ADCLK
Instruction
Execution SET SAMP CLEAR SAMP
SAMP
ch0_dischrg
ch0_samp
ch1_dischrg
ch1_samp
eoc
AD61
AD60
DONE
ADIF
ADRES(0)
ADRES(1)
1 2 3 4 5 6 7 8 5 6 7 8
AD50
ADCLK
Instruction
Execution SET ADON
SAMP
ch0_dischrg
ch0_samp
ch1_dischrg
ch1_samp
eoc
TSAMP TSAMP
AD55 AD55 TCONV
DONE
ADIF
ADRES(0)
ADRES(1)
1 2 3 4 5 6 7 3 4 5 6 8 3 4
2 – Sampling starts after discharge period. 6 – One TAD for end of conversion.
TSAMP is described in Section 17. “10-bit A/D Converter”
of the “dsPIC30F Family Reference Manual” (DS70046). 7 – Begin conversion of next channel.
XXXXXXXXXXXX dsPIC30F5015
XXXXXXXXXXXX -30I/PT e3
YYWWNNN 0712XXX
XXXXXXXXXXXX dsPIC30F5016
XXXXXXXXXXXX 30I/PT e3
YYWWNNN 0712XXX
Note: In the event the full Microchip part number cannot be marked on one line, it will
be carried over to the next line, thus limiting the number of available
characters for customer-specific information.
64-Lead Plastic Thin Quad Flatpack (PT) – 10x10x1 mm Body, 2.00 mm Footprint [TQFP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D
D1
E
e
E1
N
b
β A1
L L1
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Leads N 64
Lead Pitch e 0.50 BSC
Overall Height A – – 1.20
Molded Package Thickness A2 0.95 1.00 1.05
Standoff A1 0.05 – 0.15
Foot Length L 0.45 0.60 0.75
Footprint L1 1.00 REF
Foot Angle φ 0° 3.5° 7°
Overall Width E 12.00 BSC
Overall Length D 12.00 BSC
Molded Package Width E1 10.00 BSC
Molded Package Length D1 10.00 BSC
Lead Thickness c 0.09 – 0.20
Lead Width b 0.17 0.22 0.27
Mold Draft Angle Top α 11° 12° 13°
Mold Draft Angle Bottom β 11° 12° 13°
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Chamfers at corners are optional; size may vary.
3. Dimensions D1 and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed 0.25 mm per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-085B
/HDG3ODVWLF7KLQ4XDG)ODWSDFN37±[[PP%RG\PP>74)3@
1RWH )RUWKHPRVWFXUUHQWSDFNDJHGUDZLQJVSOHDVHVHHWKH0LFURFKLS3DFNDJLQJ6SHFLILFDWLRQORFDWHGDW
KWWSZZZPLFURFKLSFRPSDFNDJLQJ
80-Lead Plastic Thin Quad Flatpack (PT) – 12x12x1 mm Body, 2.00 mm Footprint [TQFP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D
D1
E
e
E1
b N
NOTE 1
12 3 NOTE 2 α
A
c
φ
β A2
A1
L L1
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Leads N 80
Lead Pitch e 0.50 BSC
Overall Height A – – 1.20
Molded Package Thickness A2 0.95 1.00 1.05
Standoff A1 0.05 – 0.15
Foot Length L 0.45 0.60 0.75
Footprint L1 1.00 REF
Foot Angle φ 0° 3.5° 7°
Overall Width E 14.00 BSC
Overall Length D 14.00 BSC
Molded Package Width E1 12.00 BSC
Molded Package Length D1 12.00 BSC
Lead Thickness c 0.09 – 0.20
Lead Width b 0.17 0.22 0.27
Mold Draft Angle Top α 11° 12° 13°
Mold Draft Angle Bottom β 11° 12° 13°
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Chamfers at corners are optional; size may vary.
3. Dimensions D1 and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed 0.25 mm per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-092B
/HDG3ODVWLF7KLQ4XDG)ODWSDFN37±[[PP%RG\PP>74)3@
1RWH )RUWKHPRVWFXUUHQWSDFNDJHGUDZLQJVSOHDVHVHHWKH0LFURFKLS3DFNDJLQJ6SHFLILFDWLRQORFDWHGDW
KWWSZZZPLFURFKLSFRPSDFNDJLQJ
Removed parameter D136 and updated the minimum, typical, maximum, and
conditions for parameters D122 and D134 in the Program and EEPROM
specifications (see Table 24-12).
Updated Note 1 in the Internal FRC Accuracy specifications (see Table 24-18).
U
UART
Address Detect Mode .............................................. 125
Auto-Baud Support .................................................. 126
Baud Rate Generator ............................................... 125
Disabling .................................................................. 123
Enabling ................................................................... 123
Loopback Mode ....................................................... 125
Module Overview ..................................................... 121
Operation During CPU Sleep and Idle Modes ......... 126
Receiving Data ......................................................... 124
In 8-bit or 9-bit Data Mode ............................... 124
Interrupt ........................................................... 124
Receive Buffer (UxRXB) .................................. 124
Reception Error Handling ......................................... 124
Framing Error (FERR Bit) ................................ 125
Idle Status ........................................................ 125
Parity Error (PERR Bit) .................................... 125
Receive Break ................................................. 125
Receive Buffer Overrun Error (OERR Bit) ....... 124
Setting Up Data, Parity and Stop Bit Selections ...... 123
Transmitting Data ..................................................... 123
In 8-bit Data Mode ........................................... 123
In 9-bit Data Mode ........................................... 123
Interrupt ........................................................... 124
Transmit Buffer (UxTXB) ................................. 123
UART1 Register Map ............................................... 127
Unit ID Locations .............................................................. 151
Universal Asynchronous Receiver Transmitter Module
(UART) ..................................................................... 121
W
Wake-up from Sleep ........................................................ 151
Wake-up from Sleep and Idle ............................................ 47
Watchdog Timer (WDT) ........................................... 151, 161
Enabling and Disabling ............................................ 161
From: Name
Company
Address
City / State / ZIP / Country
Telephone: (_______) _________ - _________ FAX: (______) _________ - _________
Application (optional):
Would you like a reply? Y N
Questions:
2. How does this document meet your hardware and software development needs?
3. Do you find the organization of this document easy to follow? If not, why?
4. What additions to the document do you think would enhance the structure and subject?
5. What deletions from the document could be made without affecting the overall usefulness?
d s P I C 3 0 F 5 0 1 6 AT- 3 0 I / P T- 0 0 0
Custom ID (3 digits) or
Trademark Engineering Sample (ES)
Architecture
Package
Flash PT = TQFP 10x10
PT = TQFP 12x12
S = Die (Waffle Pack)
Memory Size in Bytes W = Die (Wafers)
0 = ROMless
1 = 1K to 6K
2 = 7K to 12K
3 = 13K to 24K
4 = 25K to 48K Temperature
5 = 49K to 96K I = Industrial -40°C to +85°C
6 = 97K to 192K E = Extended High Temp -40°C to +125°C
7 = 193K to 384K
8 = 385K to 768K
9 = 769K and Up Speed
30 = 30 MIPS
Example:
dsPIC30F5016AT-30I/PT = 30 MIPS, Industrial temp., TQFP package, Rev. A
08/04/10