Professional Documents
Culture Documents
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-631-9
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
I2C™
SRAM EEPROM Timer Input A/D 12-bit
SPI
Device Pins Comp/Std
Bytes Instructions Bytes Bytes 16-bit Cap 200 Ksps
PWM
dsPIC30F2011 18 12K 4K 1024 – 3 2 2 8 ch 1 1 1
dsPIC30F3012 18 24K 8K 2048 1024 3 2 2 8 ch 1 1 1
dsPIC30F2012 28 12K 4K 1024 – 3 2 2 10 ch 1 1 1
dsPIC30F3013 28 24K 8K 2048 1024 3 2 2 10 ch 2 1 1
Pin Diagrams
MCLR 1 18 AVDD
EMUD3/AN0/VREF+/CN2/RB0 2 17 AVSS
EMUC3/AN1/VREF-/CN3/RB1
dsPIC30F2011
dsPIC30F3012
3 16 AN6/SCK1/INT0/OCFA/RB6
AN2/SS1/LVDIN/CN4/RB2 4 15 EMUD2/AN7/OC2/IC2/INT2/RB7
AN3/CN5/RB3 5 14 VDD
OSC1/CLKI 6 13 VSS
OSC2/CLKO/RC15 7 12 PGC/EMUC/AN5/U1RX/SDI1/SDA/CN7/RB5
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13 8 11 PGD/EMUD/AN4/U1TX/SDO1/SCL/CN6/RB4
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14 9 10 EMUC2/OC1/IC1/INT1/RD0
MCLR 1 28 AVDD
EMUD3/AN0/VREF+/CN2/RB0 2 27 AVSS
EMUC3/AN1/VREF-/CN3/RB1 3 26 AN6/OCFA/RB6
AN2/SS1/LVDIN/CN4/RB2 4 25 EMUD2/AN7/RB7
AN3/CN5/RB3 5 24 AN8/OC1/RB8
dsPIC30F2012
AN4/CN6/RB4 6 23 AN9/OC2/RB9
AN5/CN7/RB5 7 22 CN17/RF4
VSS 8 21 CN18/RF5
OSC1/CLKI 9 20 VDD
OSC2/CLKO/RC15 10 19 VSS
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13 11 18 PGC/EMUC/U1RX/SDI1/SDA/RF2
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14 12 17 PGD/EMUD/U1TX/SDO1/SCL/RF3
VDD 13 16 SCK1/INT0/RF6
IC2/INT2/RD9 14 15 EMUC2/IC1/INT1/RD8
MCLR 1 28 AVDD
EMUD3/AN0/VREF+/CN2/RB0 2 27 AVSS
EMUC3/AN1/VREF-/CN3/RB1 3 26 AN6/OCFA/RB6
AN2/SS1/LVDIN/CN4/RB2 4 25 EMUD2/AN7/RB7
dsPIC30F3013
AN3/CN5/RB3 5 24 AN8/OC1/RB8
AN4/CN6/RB4 6 23 AN9/OC2/RB9
AN5/CN7/RB5 7 22 U2RX/CN17/RF4
VSS 8 21 U2TX/CN18/RF5
OSC1/CLKI 9 20 VDD
OSC2/CLKO/RC15 10 19 VSS
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13 11 18 PGC/EMUC/U1RX/SDI1/SDA/RF2
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14 12 17 PGD/EMUD/U1TX/SDO1/SCL/RF3
VDD 13 16 SCK1/INT0/RF6
IC2/INT2/RD9 14 15 EMUC2/IC1/INT1/RD8
28-Pin QFN-S(1)
EMUD2/AN7/OC2/IC2/INT2/RB7
EMUD3/AN0/VREF+/CN2/RB0
EMUC3/AN1/VREF-/CN3/RB1
AN6/SCK1/INT0/OCFA/RB6
MCLR
AVDD
AVSS
22
28
27
26
24
23
25
AN2/SS1/LVDIN/CN4/RB2 1 21 NC
AN3/CN5/RB3 2 20 NC
NC 3 19 NC
NC 4 dsPIC30F2011 18 NC
VSS 5 17 VDD
OSC1/CLKI 6 16 VSS
OSC2/CLKO/RC15 7 15 PGC/EMUC/AN5/U1RX/SDI1/SDA/CN7/RB5
10
11
13
14
12
8
9
PGD/EMUD/AN4/U1TX/SDO1/SCL/CN6/RB4
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
EMUC2/OC1/IC1/INT1/RD0
VDD
NC
NC
EMUD1/SOSC1/T2CK/U1ATX/CN1/RC13
Note 1: The metal plane at the bottom of the device is not connected to any pins and is recommended to be connected to VSS externally.
28-Pin QFN-S(1)
EMUD3/AN0/VREF+/CN2/RB0
EMUC3/AN1/VREF-/CN3/RB1
EMUD2/AN7/RB7
AN6/OCFA/RB6
MCLR
AVDD
AVSS
22
28
27
26
25
24
23
AN2/SS1/LVDIN/CN4/RB2 1 21 AN8/OC1/RB8
AN3/CN5/RB3 2 20 AN9/OC2/RB9
AN4/CN6/RB4 3 19 CN17/RF4
AN5/CN7/RB5 4 dsPIC30F2012 18 CN18/RF5
VSS 5 17 VDD
OSC1/CLKI 6 16 VSS
OSC2/CLKO/RC15 7 15 PGC/EMUC/U1RX/SDI1/SDA/RF2
10
12
13
14
11
8
9
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
IC2/INT2/RD9
VDD
EMUC2/IC1/INT1/RD8
PGD/EMUD/U1TX/SDO1/SCL/RF3
SCK1/INT0/RF6
Note 1: The metal plane at the bottom of the device is not connected to any pins and is recommended to be connected to VSS externally.
44-Pin QFN(1)
PGD/EMUD/AN4/U1TX/SDO1/SCL/CN6/RB4
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
EMUC2/OC1/IC1/INT1/RD0
VDD
NC
NC
NC
NC
NC
NC
44 43 42 41 40 39 38 37 36 35 34
PGC/EMUC/AN5/U1RX/SDI1/SDA/CN7/RB5 1 33 OSC2/CLKO/RC15
VSS 2 32 OSC1/CLKI
NC 3 31 VSS
VDD 4 30 VSS
NC 5 29 NC
NC 6 dsPIC30F3012 28 NC
NC 7 27 NC
NC 8 26 NC
NC 9 25 AN3/CN5/RB3
NC 10 24 NC
NC 11 23 AN2/SS1/LVDIN/CN4/RB2
12 13 14 15 16 17 18 19 20 21 22
AVSS
AVDD
EMUD2/AN7/OC2/IC2/INT2/RB7
NC
NC
MCLR
AN6/SCK1/INT0/OCFA/RB6
EMUD3/AN0/VREF+/CN2/RB0
NC
NC
EMUC3/AN1/VREF-/CN3/RB1
Note 1: The metal plane at the bottom of the device is not connected to any pins and is recommended to be connected to VSS externally.
44-Pin QFN(1)
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
PGD/EMUD/U1TX/SDO1/SCL/RF3
EMUC2/IC1/INT1/RD8
SCK1/INT0/RF6
IC2/INT2/RD9
VDD
NC
NC
NC
NC
44
43
42
41
40
39
38
37
36
35
34
PGC/EMUC/U1RX/SDI1/SDA/RF2 1 33 OSC2/CLKO/RC15
VSS 2 32 OSC1/CLKI
NC 3 31 VSS
VDD 4 30 VSS
NC 5 29 NC
NC 6 dsPIC30F3013 28 NC
U2TX/CN18/RF5 7 27 AN5/CN7/RB5
NC 8 26 AN4/CN6/RB4
U2RX/CN17/RF4 9 25 AN3/CN5/RB3
AN9/OC2/RB9 10 24 NC
AN8/OC1/RB8 11 23 AN2/SS1/LVDIN/CN4/RB2
12
13
14
15
16
17
18
19
20
21
22
EMUD2/AN7/RB7
AN6/OCFA/RB6
EMUD3/AN0/VREF+/CN2/RB0
EMUC3/AN1/VREF-/CN3/RB1
AVSS
AVDD
NC
NC
MCLR
NC
NC
Note 1: The metal plane at the bottom of the device is not connected to any pins and is recommended to be connected to VSS externally.
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
Interrupt Data Latch Data Latch
Controller PSV & Table
Data Access Y Data X Data
24 Control Block 8 16 RAM RAM
(512 bytes) (512 bytes)
Address Address 16
24 Latch Latch
16 16 16
EMUD3/AN0/VREF+/CN2/RB0
24 X RAGU EMUC3/AN1/VREF-/CN3/RB1
Y AGU
PCU PCH PCL X WAGU AN2/SS1/LVDIN/CN4/RB2
Program Counter AN3/CN5/RB3
Address Latch Stack Loop PGD/EMUD/AN4/U1TX/SDO1/SCL/CN6/RB4
Control Control
Program Memory Logic Logic PGC/EMUC/AN5/U1RX/SDI1/SDA/CN7/RB5
(12 Kbytes) AN6/SCK1/INT0/OCFA/RB6
EMUD2/AN7/OC2/IC2/INT2/RB7
Data Latch
Effective Address PORTB
16
ROM Latch 16
24
IR EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
16 16 OSC2/CLKO/RC15
16 x 16
W Reg Array
Decode
PORTC
Instruction
Decode & 16 16
Control
DSP Divide
Power-up Engine Unit
Timer EMUC2/OC1/IC1/INT1/RD0
Input Output
12-bit ADC Capture Compare I2C™
Module Module
Y Data Bus
X Data Bus
16 16 16
16
Interrupt Data Latch Data Latch
Controller PSV & Table
Data Access Y Data X Data
24 Control Block 8 16 RAM RAM
(512 bytes) (512 bytes)
Address Address 16
24 Latch Latch
16 16 16
EMUD3/AN0/VREF+/CN2/RB0
24 X RAGU EMUC3/AN1/VREF-/CN3/RB1
Y AGU
PCU PCH PCL X WAGU AN2/SS1/LVDIN/CN4/RB2
Program Counter AN3/CN5/RB3
Address Latch Stack Loop AN4/CN6/RB4
Control Control
Logic Logic AN5/CN7/RB5
Program Memory
(12 Kbytes) AN6/OCFA/RB6
EMUD2/AN7/RB7
Data Latch AN8/OC1/RB8
Effective Address AN9/OC2/RB9
16
PORTB
ROM Latch 16
24
IR EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
16 EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
16
OSC2/CLKO/RC15
16 x 16
W Reg Array PORTC
Decode
Instruction
Decode & 16 16
Control
DSP Divide
Power-up Engine Unit
Timer
Timing Oscillator EMUC2/IC1/INT1/RD8
OSC1/CLKI
Generation Start-up Timer IC2/INT2/RD9
POR/BOR ALU<16>
Reset
PORTD
Watchdog 16 16
MCLR
Timer
Low-Voltage
VDD, VSS Detect
AVDD, AVSS
Input Output
12-bit ADC Capture Compare I2C™
Module Module
PGC/EMUC/U1RX/SDI1/SDA/RF2
PGD/EMUD/U1TX/SDO1/SCL/RF3
CN17/RF4
CN18/RF5
SCK1/INT0/RF6
Timers SPI1 UART1
PORTF
Y Data Bus
X Data Bus
16 16 16
16
Interrupt Data Latch Data Latch
Controller PSV & Table
Data Access Y Data X Data
24 Control Block 8 16 RAM RAM
(1 Kbytes) (1 Kbytes)
Address Address 16
24 Latch Latch
16 16 16
EMUD3/AN0/VREF+/CN2/RB0
24 X RAGU EMUC3/AN1/VREF-/CN3/RB1
Y AGU
PCU PCH PCL X WAGU AN2/SS1/LVDIN/CN4/RB2
Program Counter AN3/CN5/RB3
Address Latch Stack Loop PGD/EMUD/AN4/U1TX/SDO1/SCL/CN6/RB4
Control Control
Program Memory Logic Logic PGC/EMUC/AN5/U1RX/SDI1/SDA/CN7/RB5
(24 Kbytes) AN6/SCK1/INT0/OCFA/RB6
EMUD2/AN7/OC2/IC2/INT2/RB7
Data EEPROM
(1 Kbytes) Effective Address PORTB
Data Latch 16
ROM Latch 16
24
IR EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
16 16 OSC2/CLKO/RC15
16 x 16
W Reg Array
Decode
PORTC
Instruction
Decode & 16 16
Control
DSP Divide
Power-up Engine Unit
Timer EMUC2/OC1/IC1/INT1/RD0
Input Output
12-bit ADC Capture Compare I2C™
Module Module
Y Data Bus
X Data Bus
16 16 16
16
Interrupt Data Latch Data Latch
Controller PSV & Table
Data Access Y Data X Data
24 Control Block 8 16 RAM RAM
(1 Kbytes) (1 Kbytes)
Address Address 16
24 Latch Latch
16 16 16
EMUD3/AN0/VREF+/CN2/RB0
24 X RAGU EMUC3/AN1/VREF-/CN3/RB1
Y AGU
PCU PCH PCL X WAGU AN2/SS1/LVDIN/CN4/RB2
Address Latch Program Counter AN3/CN5/RB3
Program Memory Stack Loop AN4/CN6/RB4
Control Control
(24 Kbytes) Logic Logic AN5/CN7/RB5
AN6/OCFA/RB6
Data EEPROM
(1 Kbytes) EMUD2/AN7/RB7
AN8/OC1/RB8
Data Latch Effective Address AN9/OC2/RB9
16
PORTB
ROM Latch 16
24
IR EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
16 EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
16
OSC2/CLKO/RC15
16 x 16
W Reg Array PORTC
Decode
Instruction
Decode & 16 16
Control
DSP Divide
Power-up Engine Unit
Timer
Timing Oscillator EMUC2/IC1/INT1/RD8
OSC1/CLKI
Generation Start-up Timer IC2/INT2/RD9
POR/BOR ALU<16>
Reset
PORTD
Watchdog 16 16
MCLR
Timer
Low-Voltage
VDD, VSS Detect
AVDD, AVSS
Input Output
12-bit ADC Capture Compare I2C™
Module Module
PGC/EMUC/U1RX/SDI1/SDA/RF2
PGD/EMUD/U1TX/SDO1/SCL/RF3
U2RX/CN17/RF4
U2TX/CN18/RF5
SCK1/INT0/RF6
Timers SPI1 UART1,
UART2
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
When the multiplier is configured for fractional The adder has an additional saturation block which
multiplication, the data is represented as a two’s controls accumulator data saturation if selected. It uses
complement fraction, where the MSB is defined as a the result of the adder, the overflow Status bits
sign bit and the radix point is implied to lie just after the described above, and the mode control bits SATA/B
sign bit (QX format). The range of an N-bit two’s (CORCON<7:6>) and ACCSAT (CORCON<4>) to
complement fraction with this implied radix point is -1.0 determine when and to what value to saturate.
to (1 – 21-N). For a 16-bit fraction, the Q15 data range Six STATUS register bits have been provided to
is -1.0 (0x8000) to 0.999969482 (0x7FFF) including ‘0’ support saturation and overflow. They are:
and has a precision of 3.01518x10-5. In Fractional • OA: ACCA overflowed into guard bits
mode, the 16x16 multiply operation generates a 1.31
• OB: ACCB overflowed into guard bits
product, which has a precision of 4.65661 x 10-10.
• SA: ACCA saturated (bit 31 overflow and
The same multiplier is used to support the MCU saturation)
multiply instructions, which include integer 16-bit or
signed, unsigned and mixed sign multiplies. ACCA overflowed into guard bits and saturated
The MUL instruction can be directed to use byte or (bit 39 overflow and saturation)
word-sized operands. Byte operands direct a 16-bit • SB: ACCB saturated (bit 31 overflow and
result. Word operands direct a 32-bit result to the saturation)
specified register(s) in the W array. or
ACCB overflowed into guard bits and saturated
2.4.2 DATA ACCUMULATORS AND (bit 39 overflow and saturation)
ADDER/SUBTRACTER • OAB: Logical OR of OA and OB
The data accumulator consists of a 40-bit • SAB: Logical OR of SA and SB
adder/subtracter with automatic sign extension logic. It
The OA and OB bits are modified each time data
can select one of two accumulators (A or B) as its
passes through the adder/subtracter. When set, they
pre-accumulation source and post-accumulation
indicate that the most recent operation has overflowed
destination. For the ADD and LAC instructions, the data
into the accumulator guard bits (bits 32 through 39).
to be accumulated or loaded can be optionally scaled
The OA and OB bits can also optionally generate an
through the barrel shifter prior to accumulation.
arithmetic warning trap when set and the
corresponding overflow trap flag enable bit (OVATE,
OVBTE) in the INTCON1 register (refer to Section 8.0
“Interrupts”) is set. This allows the user to take
immediate action, for example, to correct system gain.
dsPIC30F2011/2012 dsPIC30F3012/3013
Reset - GOTO Instruction 000000 Reset - GOTO Instruction 000000
Reset - Target Address 000002 Reset - Target Address 000002
000004 000004
00007E 00007E
Reserved 000080 Reserved 000080
000084
User Memory
000084
Space
Space
0000FE 0000FE
User Flash 000100 User Flash 000100
Program Memory Program Memory
(4K instructions) (8K instructions)
001FFE 003FFE
002000 004000
Reserved
(Read ‘0’s)
Reserved 7FFBFE
(Read ‘0’s) 7FFC00
Data EEPROM
(1 Kbyte)
7FFFFE 7FFFFE
800000 800000
Reserved Reserved
Configuration Memory
Configuration Memory
8005BE 8005BE
Space
Space
8005C0 8005C0
UNITID (32 instr.) UNITID (32 instr.)
8005FE 8005FE
800600 800600
Reserved Reserved
F7FFFE F7FFFE
Device Configuration F80000 Device Configuration F80000
Registers F8000E Registers F8000E
F80010 F80010
Reserved Reserved
FEFFFE FEFFFE
DEVID (2) FF0000 DEVID (2) FF0000
FFFFFE 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/
Configuration Byte
Space 24-bit EA
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 LS 15 bits of data space
VISIBILITY addresses directly map to the LS 15 bits in the
corresponding program space addresses. The
The upper 32 Kbytes of data space may optionally be remaining bits are provided by the Program Space
mapped into any 16K word program space page. This Visibility Page register, PSVPAG<7:0>, as shown in
provides transparent access of stored constant data 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 that use PSV which 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 require one instruction
CORCON are discussed in Section 2.4 “DSP
cycle in addition to the specified execution time:
Engine”.
- MAC class of instructions with data operand
Data accesses to this area add an additional cycle to prefetch
the instruction being executed, since two program
- MOV instructions
memory fetches are required.
- MOV.D instructions
Note that the upper half of addressable data space is
• All other instructions require two instruction cycles
always part of the X data space. Therefore, when a
in addition to the specified execution time of the
DSP operation uses program space mapping to access
instruction.
this memory region, Y data space should typically
contain state (variable) data for DSP operations, For instructions that use PSV which are executed
whereas X data space should typically contain inside a REPEAT loop:
coefficient (constant) data. • The following instances require two instruction
Although each data space address, 0x8000 and higher, cycles in addition to the specified execution time
maps directly into a corresponding program memory of the instruction:
address (see Figure 3-5), only the lower 16 bits of the - Execution in the first iteration
24-bit program word are used to contain the data. The - Execution in the last iteration
upper 8 bits should be programmed to force an illegal - Execution prior to exiting the loop due to an
instruction to maintain machine robustness. Refer to interrupt
the “16-bit MCU and DSC Programmer’s Reference
- Execution upon re-entering the loop after an
Manual” (DS70157) for details on instruction encoding.
interrupt is serviced
• Any other iteration of the REPEAT loop 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
15 23 15 0
EA Address
EA<15> = 1 Concatenation 23 0x001200
15
Data Read
BSET CORCON,#2 ; Set PSV bit
MOV #0x0, W0 ; Set PSVPAG register
MOV W0, PSVPAG
MOV 0x9200, W0 ; Access program memory location
; using a data space access
Note 1: PSVPAG is an 8-bit register, containing bits <22:15> of the program space address.
MSB LSB
Address 16 bits Address
MSB LSB
0x0001 0x0000
2 Kbyte
SFR Space
SFR Space 0x07FE
0x07FF
0x0801 0x0800
X Data RAM (X) 8 Kbyte
0x09FF 0x09FE Near
1 Kbyte 0x0A01 0x0A00 Data
SRAM Space Y Data RAM (Y) Space
0x0BFF 0x0BFE
0x0C01 0x0C00
0x1FFF 0x1FFE
0x8001 0x8000
Optionally X Data
Mapped Unimplemented (X)
into Program
Memory
0xFFFF 0xFFFE
MSB LSB
Address 16 bits Address
MSB LSB
0x0001 0x0000
2 Kbyte
SFR Space
SFR Space 0x07FE
0x07FF
0x0801 0x0800
X Data RAM (X) 8 Kbyte
2 Kbyte 0x0BFF 0x0BFE Near
0x0C01 0x0C00 Data
SRAM Space Space
Y Data RAM (Y)
0x0FFF 0x0FFE
0x1001 0x1000
0x1FFF 0x1FFE
0x8001 0x8000
Optionally X Data
Mapped Unimplemented (X)
into Program
Memory
0xFFFF 0xFFFE
X SPACE
UNUSED
X SPACE
X SPACE
UNUSED
Indirect EA using any W Indirect EA using W8, W9 Indirect EA using W10, W11
dsPIC30F2011/2012/3012/3013
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)
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)
CORCON 0044 — — — US EDT DL2 DL1 DL0 SATA SATB SATDW ACCSAT IPL3 PSV RND IF 0000 0000 0010 0000
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: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F2011/2012/3012/3013
DS70139G-page 41
dsPIC30F2011/2012/3012/3013
NOTES:
Byte
Address MOV #0x1100,W0
MOV W0,XMODSRT ;set modulo start address
MOV #0x1163,W0
MOV W0,MODEND ;set modulo end address
0x1100 MOV #0x8001,W0
MOV W0,MODCON ;enable W1, X AGU for modulo
Pivot Point
XB = 0x0008 for a 16-word Bit-Reversed Buffer
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 5-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: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F2011/2012/3012/3013
DS70139G-page 53
dsPIC30F2011/2012/3012/3013
NOTES:
1
PIO Module Output Data
0
Read TRIS
WR TRIS CK
TRIS Latch
D Q
WR LAT +
WR Port CK
Data Latch
Read LAT
Input Data
Read Port
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
TRISB 02C6 — — — — — — — — TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 0000 0000 1111 1111
PORTB 02C8 — — — — — — — — RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 0000 0000 0000 0000
LATB 02CB — — — — — — — — LATB7 LATB6 LATB5 LATB4 LATB3 LATB2 LATB1 LATB0 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
TRISB 02C6 — — — — — — TRISB9 TRISB8 TRISB7 TRISB6 TRISB5 TRISB4 TRISB3 TRISB2 TRISB1 TRISB0 0000 0011 1111 1111
PORTB 02C8 — — — — — — RB9 RB8 RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0 0000 0000 0000 0000
dsPIC30F2011/2012/3012/3013
LATB 02CB — — — — — — LATB9 LATB8 LATB7 LATB6 LATB5 LATB4 LATB3 LATB2 LATB1 LATB0 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
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
TRISF 02DE — — — — — — — — — TRISF6 TRISF5 TRISF4 TRISF3 TRISF2 — — 0000 0000 0111 1100
PORTF 02E0 — — — — — — — — — RF6 RF5 RF4 RF3 RF2 — — 0000 0000 0000 0000
dsPIC30F2011/2012/3012/3013
LATF 02E2 — — — — — — — — — LATF6 LATF5 LATF4 LATF3 LATF2 — — 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note: The dsPIC30F2011/3012 devices do not have TRISF, PORTF, or LATF.
DS70139G-page 62
dsPIC30F2011/2012/3012/3013
7.3 Input Change Notification Module
The input change notification module provides the
dsPIC30F devices the ability to generate interrupt
requests to the processor, in response to a change of
state on selected input pins. This module is capable of
detecting input change of states even in Sleep mode,
when the clocks are disabled. There are up to 10
external signals (CN0 through CN7, CN17 and CN18)
that may be selected (enabled) for generating an
interrupt request on a change of state.
TABLE 7-7: INPUT CHANGE NOTIFICATION REGISTER MAP FOR dsPIC30F2011/3012 (BITS 7-0)
SFR
Address 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 — — — — — — — — 0000 0000 0000 0000
CNPU1 00C4 CN7PUE CN6PUE CN5PUE CN4PUE CN3PUE CN2PUE CN1PUE CN0PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — — — — 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
TABLE 7-8: INPUT CHANGE NOTIFICATION REGISTER MAP FOR dsPIC30F2012/3013 (BITS 7-0)
SFR
Address 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 — 0000 0000 0000 0000
CNPU1 00C4 CN7PUE CN6PUE CN5PUE CN4PUE CN3PUE CN2PUE CN1PUE CN0PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — CN18PUE CN17PUE — 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
Higher Address
Stack Error Trap Vector
Decreasing
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 — — — — — — — — — — — 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 — — — — — — — — INT2IF — — — — — — INT1IF 0000 0000 0000 0000
IFS2 0088 — — — — — LVDIF — — — — — — — — — 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 — — — — — — — — INT2IE — — — — — — INT1IE 0000 0000 0000 0000
IEC2 0090 — — — — — LVDIE — — — — — — — — — — 0000 0000 0000 0000
IPC0 0094 — T1IP<2:0> — OC1IP<2:0> — IC1IP<2:0> — INT0IP<2:0> 0100 0100 0100 0100
dsPIC30F2011/2012/3012/3013
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 — — — — — — — — — — — — — INT1IP<2:0> 0000 0000 0000 0100
IPC5 009E — INT2IP<2:0> — — — — — — — — — — — — 0100 0000 0000 0000
IPC6 00A0 — — — — — — — — — 1 0 0 — 1 0 0 0000 0000 0100 0100
IPC7 00A2 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC8 00A4 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC9 00A6 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC10 00A8 — — — — — LVDIP<2:0> — — — — — — — — 0000 0100 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70139G-page 71
TABLE 8-3: dsPIC30F3013 INTERRUPT CONTROLLER REGISTER MAP
DS70139G-page 72
dsPIC30F2011/2012/3012/3013
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 — — — — — — — — — — — 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 — — — — — — U2TXIF U2RXIF INT2IF — — — — — — INT1IF 0000 0000 0000 0000
IFS2 0088 — — — — — LVDIF — — — — — — — — — — 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 — — — — — U2TXIE U2RXIE INT2IE — — — — — — INT1IE 0000 0000 0000 0000
IEC2 0090 — — — — — LVDIE — — — — — — — — — — 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 — — — — — — — — — — — — — INT1IP<2:0> 0000 0000 0000 0100
IPC5 009E — INT2IP<2:0> — — — — — — — — — 0100 0000 0000 0000
IPC6 00A0 — — — — — — — — — U2TXIP<2:0> — U2RXIP<2:0> 0000 0000 0100 0100
IPC7 00A2 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC8 00A4 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC9 00A6 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC10 00A8 — — — — — LVDIP<2:0> — — — — — — — — 0000 0100 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2010 Microchip Technology Inc.
dsPIC30F2011/2012/3012/3013
9.0 TIMER1 MODULE These operating modes are determined by setting the
appropriate bit(s) in the 16-bit SFR, T1CON. Figure 9-1
Note: This data sheet summarizes features of presents a block diagram of the 16-bit timer module.
this group of dsPIC30F devices and is not 16-bit Timer Mode: In the 16-bit Timer mode, the timer
intended to be a complete reference increments on every instruction cycle up to a match
source. For more information on the CPU, value preloaded into the Period register PR1, then
peripherals, register descriptions and resets to ‘0’ and continues to count.
general device functionality, refer to the
“dsPIC30F Family Reference Manual” When the CPU goes into the Idle mode, the timer stops
(DS70046). incrementing unless the TSIDL (T1CON<13>) bit = 0.
If TSIDL = 1, the timer module logic resumes the incre-
This section describes the 16-bit general purpose menting sequence on termination of CPU Idle mode.
Timer1 module and associated operational modes. 16-bit Synchronous Counter Mode: In the 16-bit
Figure 9-1 depicts the simplified block diagram of the Synchronous Counter mode, the timer increments on
16-bit Timer1 module. The following sections provide the rising edge of the applied external clock signal
detailed descriptions including setup and Control which is synchronized with the internal phase clocks.
registers, along with associated block diagrams for the The timer counts up to a match value preloaded in PR1,
operational modes of the timers. then resets to ‘0’ and continues.
The Timer1 module is a 16-bit timer that serves as the When the CPU goes into the Idle mode, the timer stops
time counter for the real-time clock or operates as a incrementing unless the respective TSIDL bit = 0. If
free-running interval timer/counter. The 16-bit timer has TSIDL = 1, the timer module logic resumes the
the following modes: incrementing sequence upon termination of the CPU
• 16-bit Timer Idle mode.
• 16-bit Synchronous Counter 16-bit Asynchronous Counter Mode: In the 16-bit
• 16-bit Asynchronous Counter Asynchronous Counter mode, the timer increments on
These operational characteristics are supported: every rising edge of the applied external clock signal.
The timer counts up to a match value preloaded in PR1,
• Timer gate operation
then resets to ‘0’ and continues.
• Selectable prescaler settings
• Timer operation during CPU Idle and Sleep When the timer is configured for the Asynchronous
modes mode of operation and the CPU goes into the Idle
mode, the timer stops incrementing if TSIDL = 1.
• Interrupt on 16-bit Period register match or falling
edge of external gate signal
PR1
Equal
Comparator x 16 TSYNC
1 Sync
TMR1
Reset
0
0
T1IF
Event Flag 1 Q D TGATE
TGATE
Q CK
TCS
TGATE TCKPS<1:0>
SOSCO/ TON 2
T1CK 1x
Gate Prescaler
LPOSCEN
Sync 01 1, 8, 64, 256
SOSCI
TCY 00
The TMR1 register is not cleared when the T1CON 32.768 kHz dsPIC30FXXXX
register is written. It is cleared by writing to the TMR1 XTAL
register. SOSCO
The timer operates during CPU Sleep mode, if: C1 = C2 = 18 pF; R = 100K
dsPIC30F2011/2012/3012/3013
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
Data Bus<15:0>
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
Gate Prescaler
Sync 01 1, 8, 64, 256
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 1x
Gate Prescaler
Sync 01 1, 8, 64, 256
TCY 00
PR3
TMR3
Reset
0
T3IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
TON 2
T3CK Sync 1x
Prescaler
01 1, 8, 64, 256
TCY 00
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
dsPIC30F2011/2012/3012/3013
DS70139G-page 81
dsPIC30F2011/2012/3012/3013
NOTES:
16 16
ICTMR
ICx pin 1 0
Prescaler Clock Edge FIFO
1, 4, 16 Synchronizer Detection R/W
Logic Logic
3 ICM<2:0>
Mode Select ICxBUF
ICBNE, ICOV
ICI<1:0>
Interrupt
ICxCON Logic
Note 1: Where ‘x’ is shown, reference is made to the registers or bits associated to the respective input capture
channel (1 or 2).
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
dsPIC30F2011/2012/3012/3013
DS70139G-page 85
dsPIC30F2011/2012/3012/3013
NOTES:
OCxRS
OCxR Output S Q
Logic R
OCx
Output
3
Enable
OCM<2:0>
Comparator Mode Select
OCTSEL OCFA
0 1 0 1 (for x = 1, 2, 3 or 4)
From GP
Timer Module
Note 1: Where ‘x’ is shown, reference is made to the registers associated with the respective output compare
channel (1 or 2).
12.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
1. Set the PWM period by writing to the appropriate
configured for one of two Dual Output Compare modes,
period register.
which 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.
12.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 bit (TxCON<15>) = 1.
of a single output pulse, the following steps are
required (assuming timer is off): 12.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/B pin, the
channel 1 to 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 is maintained until both of the following events
• Set OCM<2:0> = 100. have occurred:
• Enable timer, TON bit (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
TMR3 = PR3
TMR3 = PR3 T3IF = 1
T3IF = 1 (Interrupt Flag)
(Interrupt Flag) OCxR = OCxRS
OCxR = OCxRS
TMR3 = Duty Cycle TMR3 = Duty Cycle
(OCxR) (OCxR)
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 OCTSEL OCM<2:0> 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F2011/2012/3012/3013
DS70139G-page 91
dsPIC30F2011/2012/3012/3013
NOTES:
Internal
Data Bus
Read Write
SPIxBUF SPIxBUF
Receive Transmit
SPI1SR
SDI1 bit 0
SDO1 Shift
Clock
SS & FSYNC Clock Edge
Control Select
Control
SS1
Secondary Primary
Prescaler Prescaler FCY
1:1 – 1:8 1, 4, 16, 64
SCK1
Enable Master Clock
SDO1 SDI1
13.3 Slave Select Synchronization 13.5 SPI Operation During CPU Idle
The SS1 pin allows a Synchronous Slave mode. The
Mode
SPI must be configured in SPI Slave mode with SS1 When the device enters Idle mode, all clock sources
pin control enabled (SSEN = 1). When the SS1 pin is remain functional. The SPISIDL bit (SPI1STAT<13>)
low, transmission and reception are enabled and the selects if the SPI module will stop or continue on idle. If
SDOx pin is driven. When SS1 pin goes high, the SPISIDL = 0, the module will continue to operate when
SDOx pin is no longer driven. Also, the SPI module is the CPU enters Idle mode. If SPISIDL = 1, the module
resynchronized, and all counters/control circuitry are will stop when the CPU enters Idle mode.
reset. Therefore, when the SS1 pin is asserted low
again, transmission/reception will begin at the MSb
even if SS1 had been de-asserted in the middle of a
transmit/receive.
dsPIC30F2011/2012/3012/3013
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: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2010 Microchip Technology Inc.
dsPIC30F2011/2012/3012/3013
14.0 I2C™ MODULE 14.1.1 VARIOUS I2C MODES
The following types of I2C operation are supported:
Note: This data sheet summarizes features of
this group of dsPIC30F devices and is not • I2C slave operation with 7-bit addressing
intended to be a complete reference • I2C slave operation with 10-bit addressing
source. For more information on the CPU, • I2C master operation with 7-bit or 10-bit addressing
peripherals, register descriptions and
See the I2C programmer’s model (Figure 14-1).
general device functionality, refer to the
“dsPIC30F Family Reference Manual”
14.1.2 PIN CONFIGURATION IN I2C MODE
(DS70046).
I2C has a 2-pin interface; the SCL pin is clock and the
2 TM
The Inter-Integrated Circuit (I C ) module provides SDA pin is data.
complete hardware support for both Slave and
Multi-Master modes of the I2C serial communication 14.1.3 I2C REGISTERS
standard, with a 16-bit interface. I2CCON and I2CSTAT are control and status registers,
This module offers the following key features: respectively. The I2CCON register is readable and
• I2C interface supporting both master and slave writable. The lower 6 bits of I2CSTAT are read-only.
operation. The remaining bits of the I2CSTAT are read/write.
• I2C Slave mode supports 7-bit and 10-bit I2CRSR is the shift register used for shifting data,
addressing. whereas I2CRCV is the buffer register to which data
• I2C Master mode supports 7-bit and 10-bit bytes are written, or from which data bytes are read.
addressing. I2CRCV is the receive buffer as shown in Figure 14-1.
I2CTRN is the transmit register to which bytes are
• I2C port allows bidirectional transfers between
written during a transmit operation, as shown in
master and slaves.
Figure 14-2.
• Serial clock synchronization for I2C port can be
used as a handshake mechanism to suspend and The I2CADD register holds the slave address. A Status
resume serial transfer (SCLREL control). bit, ADD10, indicates 10-bit Address mode. The
I2CBRG acts as the Baud Rate Generator reload
• I2C supports multi-master operation; detects bus
value.
collision and will arbitrate accordingly.
In receive operations, I2CRSR and I2CRCV together
14.1 Operating Function Description form a double-buffered receiver. When I2CRSR
receives a complete byte, it is transferred to I2CRCV
The hardware fully implements all the master and slave and an interrupt pulse is generated. During
functions of the I2C Standard and Fast mode transmission, the I2CTRN is not double-buffered.
specifications, as well as 7 and 10-bit addressing.
Note: Following a Restart condition in 10-bit
Thus, the I2C module can operate either as a slave or mode, the user only needs to match the
a master on an I2C bus. 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
LSB
Shift Read
Clock
Reload
Control Write
0x01-0x03 Reserved
0x04-0x07 Hs-mode Master codes 14.4 I2C 10-bit Slave Mode Operation
0x04-0x77 Valid 7-bit addresses In 10-bit mode, the basic receive and transmit
0x78-0x7b Valid 10-bit addresses (lower 7 operations are the same as in the 7-bit mode. However,
bits) the criteria for address match is more complex.
0x7c-0x7f Reserved The I2C specification dictates that a slave must be
addressed for a write operation with two address bytes
14.3 I2C 7-bit Slave Mode Operation following a Start bit.
The A10M bit is a control bit that signifies that the
Once enabled (I2CEN = 1), the slave module will wait address in I2CADD is a 10-bit address rather than a 7-bit
for a Start bit to occur (i.e., the I2C module is ‘Idle’). address. The address detection protocol for the first byte
Following the detection of a Start bit, 8 bits are shifted of a message address is identical for 7-bit and 10-bit
into I2CRSR and the address is compared against messages, but the bits being compared are different.
I2CADD. In 7-bit mode (A10M = 0), bits I2CADD<6:0>
are compared against I2CRSR<7:1> and I2CRSR<0> I2CADD holds the entire 10-bit address. Upon
is the R_W bit. All incoming bits are sampled on the ris- receiving an address following a Start bit, I2CRSR
ing edge of SCL. <7:3> is compared against a literal ‘11110’ (the default
10-bit address) and I2CRSR<2:1> are compared
If an address match occurs, an acknowledgement will against I2CADD<9:8>. If a match occurs and if
be sent, and the slave event interrupt flag (SI2CIF) is R_W = 0, the interrupt pulse is sent. The ADD10 bit will
set on the falling edge of the ninth (ACK) bit. The be cleared to indicate a partial address match. If a
address match does not affect the contents of the match fails or R_W = 1, the ADD10 bit is cleared and
I2CRCV buffer or the RBF bit. the module returns to the Idle state.
14.3.1 SLAVE TRANSMISSION The low byte of the address is then received and
compared with I2CADD<7:0>. If an address match
If the R_W bit received is a ‘1’, then the serial port will
occurs, the interrupt pulse is generated and the ADD10
go into Transmit mode. It will send ACK on the ninth bit
bit is set, indicating a complete 10-bit address match. If
and then hold SCL to ‘0’ until the CPU responds by
an address match did not occur, the ADD10 bit is
writing to I2CTRN. SCL is released by setting the
cleared 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. 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.
In Slave Transmit modes, clock stretching is always 14.5.4 CLOCK STRETCHING DURING
performed irrespective of the STREN bit. 10-BIT ADDRESSING (STREN = 1)
Clock synchronization takes place following the ninth Clock stretching takes place automatically during the
clock of the transmit sequence. If the device samples addressing sequence. Because this module has a
an ACK on the falling edge of the ninth clock and if the register for the entire address, it is not necessary for
TBF bit is still clear, then the SCLREL bit is the protocol to wait for the address to be updated.
automatically cleared. The SCLREL being cleared to
‘0’ will assert the SCL line low. The user’s ISR must set After the address phase is complete, clock stretching
the SCLREL bit before transmission is allowed to will occur on each data receive or transmit sequence as
continue. By holding the SCL line low, the user has time was described earlier.
to service the ISR and load the contents of the I2CTRN
before the master device can initiate another transmit 14.6 Software Controlled Clock
sequence. Stretching (STREN = 1)
Note 1: If the user loads the contents of I2CTRN, When the STREN bit is ‘1’, the SCLREL bit may be
setting the TBF bit before the falling edge cleared by software to allow software to control the
of the ninth clock, the SCLREL bit will not clock stretching. The logic will synchronize writes to the
be cleared and clock stretching will not SCLREL bit with the SCL clock. Clearing the SCLREL
occur. bit will not assert the SCL output until the module
2: The SCLREL bit can be set in software, detects a falling edge on the SCL output and SCL is
regardless of the state of the TBF bit. sampled low. If the SCLREL bit is cleared by the user
while the SCL line has been sampled low, the SCL
14.5.2 RECEIVE CLOCK STRETCHING output will be asserted (held low). The SCL output will
remain low until the SCLREL bit is set, and all other
The STREN bit in the I2CCON register can be used to devices on the I2C bus have de-asserted SCL. This
enable clock stretching in Slave Receive mode. When ensures that a write to the SCLREL bit will not violate
the STREN bit is set, the SCL pin will be held low at the the minimum high time requirement for SCL.
end of each data receive sequence.
If the STREN bit is ‘0’, a software write to the SCLREL
14.5.3 CLOCK STRETCHING DURING bit will be disregarded and have no effect on the
7-BIT ADDRESSING (STREN = 1) SCLREL bit.
As per the I2C standard, FSCK may be 100 kHz or The master will continue to monitor the SDA and SCL
400 kHz. However, the user can specify any baud rate pins, and if a Stop condition occurs, the MI2CIF bit will
up to 1 MHz. I2CBRG values of ‘0’ or ‘1’ are illegal. be set.
A write to the I2CTRN will start the transmission of data
EQUATION 14-1: SERIAL CLOCK RATE at the first data bit regardless of where the transmitter
left off when bus collision occurred.
In a multi-master environment, the interrupt generation
I2CBRG = ( FFSCL
CY – FCY
1,111,111
) –1
on the detection of Start and Stop conditions allows the
determination of when the bus is free. Control of the I2C
bus can be taken when the P bit is set in the I2CSTAT
14.12.4 CLOCK ARBITRATION register, or the bus is Idle and the S and P bits are
Clock arbitration occurs when the master de-asserts cleared.
the SCL pin (SCL allowed to float high) during any
receive, transmit, or Restart/Stop condition. When the 14.13 I2C Module Operation During CPU
SCL pin is allowed to float high, the Baud Rate Sleep and Idle Modes
Generator (BRG) is suspended from counting until the
SCL pin is actually sampled high. When the SCL pin is 14.13.1 I2C OPERATION DURING CPU
sampled high, the Baud Rate Generator is reloaded SLEEP MODE
with the contents of I2CBRG and begins counting. This
When the device enters Sleep mode, all clock sources
ensures that the SCL high time will always be at least
to the module are shut down and stay at logic ‘0’. If
one BRG rollover count in the event that the clock is
Sleep occurs in the middle of a transmission and the
held low by an external device.
state machine is partially into a transmission as the
clocks stop, then the transmission is aborted. Similarly,
14.12.5 MULTI-MASTER COMMUNICATION,
if Sleep occurs in the middle of a reception, then the
BUS COLLISION, AND BUS reception is aborted.
ARBITRATION
Multi-master operation support is achieved by bus 14.13.2 I2C OPERATION DURING CPU IDLE
arbitration. When the master outputs address/data bits MODE
onto the SDA pin, arbitration takes place when the For the I2C, the I2CSIDL bit selects if the module will
master outputs a ‘1’ on SDA by letting SDA float high stop on Idle or continue on Idle. If I2CSIDL = 0, the
while another master asserts a ‘0’. When the SCL pin module will continue operation on assertion of the Idle
floats high, data should be stable. If the expected data mode. If I2CSIDL = 1, the module will stop on Idle.
on SDA is a ‘1’ and the data sampled on the SDA
pin = 0, then a bus collision has taken place. The
master will set the MI2CIF pulse and reset the master
portion of the I2C port to its Idle state.
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
dsPIC30F2011/2012/3012/3013
DS70139G-page 103
dsPIC30F2011/2012/3012/3013
NOTES:
Write Write
Load TSR
UxTXIF
UTXBRK
Data
Transmit Shift Register (UxTSR)
‘0’ (Start)
UxTX
‘1’ (Stop)
Control
Signals
Note: x = 1 or 2.
UxMODE UxSTA
LPBACK 8-9
From UxTX
1 Load RSR
FERR
to Buffer
PERR
Control
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 — — ALTIO — — 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’
U2MODE 0216 UARTEN — USIDL — — — — — WAKE LPBACK ABAUD — — PDSEL1 PDSEL0 STSEL 0000 0000 0000 0000
dsPIC30F2011/2012/3012/3013
U2STA 0218 UTXISEL — — — UTXBRK UTXEN UTXBF TRMT URXISEL1 URXISEL0 ADDEN RIDLE PERR FERR OERR URXDA 0000 0001 0001 0000
U2TXREG 021A — — — — — — — UTX8 Transmit Register 0000 000u uuuu uuuu
U2RXREG 021C — — — — — — — URX8 Receive Register 0000 0000 0000 0000
U2BRG 021E Baud Rate Generator Prescaler 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note 1: UART2 is not available on dsPIC30F2011/2012/3012 devices.
2: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70139G-page 111
dsPIC30F2011/2012/3012/3013
NOTES:
AVDD/VREF+
AVSS/VREF-
0000 Comparator
AN0
DAC
0001
AN1
0010
AN2
0011 12-bit SAR Conversion Logic
AN3
AN4 0100
Data Format
0110
AN6
0111
AN7
S/H CH0
Input Input MUX
Switches Control
TAD Sampling
Speed Rs Max VDD Temperature Channel Configuration
Minimum Time Min
Up to 200 334 ns 1 TAD 2.5 kΩ 4.5V -40°C to +85°C
ksps(1) to VREF- VREF+
5.5V
ANx CHX
S/H ADC
ANx CHX
S/H ADC
ANx or VREF-
Note 1: External VREF- and VREF+ pins must be used for correct operation. See Figure 16-2 for recommended
circuit.
C2 C1 VDD C8 C7 C6
0.1 μF 0.01 μF 1 μF 0.1 μF 0.01 μF
R1
10
VSS
AVDD
VREF-
22
27
26
23
1 21
2 20
3 19
VDD
4 dsPIC30F2011 18
AVDD AVDD AVDD
VSS VDD
6 VSS
C5 C4 C3
VDD
7 15
1 μF 0.1 μF 0.01 μF
11
13
14
12
8
9
VDD
Note 1: Ensure adequate bypass capacitors are provided on each VDD pin.
CHOLD
VA CPIN I leakage = DAC capacitance
VT = 0.6V ± 500 nA = 18 pF
VSS
Note: CPIN value depends on device package and is not tested. Effect of CPIN negligible if Rs ≤2.5 kΩ.
RAM Contents: d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Read to Bus:
Signed Fractional d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0
Fractional d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0
Signed Integer d11 d11 d11 d11 d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Integer 0 0 0 0 d11 d10 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
dsPIC30F2011/2012/3012/3013
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
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
dsPIC30F2011/2012/3012/3013
ADCBUFA 0294 — — — — ADC Data Buffer 10 0000 uuuu uuuu uuuu
ADCBUFB 0296 — — — — ADC Data Buffer 11 0000 uuuu uuuu uuuu
ADCBUFC 0298 — — — — ADC Data Buffer 12 0000 uuuu uuuu uuuu
ADCBUFD 029A — — — — ADC Data Buffer 13 0000 uuuu uuuu uuuu
ADCBUFE 029C — — — — ADC Data Buffer 14 0000 uuuu uuuu uuuu
ADCBUFF 029E — — — — ADC Data Buffer 15 0000 uuuu uuuu uuuu
ADCON1 02A0 ADON — ADSIDL — — — FORM<1:0> SSRC<2:0> — — ASAM SAMP DONE 0000 0000 0000 0000
ADCON2 02A2 VCFG<2:0> — — CSCNA — — BUFS — SMPI<3:0> BUFM ALTS 0000 0000 0000 0000
ADCON3 02A4 — — — SAMC<4:0> ADRC — ADCS<5:0> 0000 0000 0000 0000
ADCHS 02A6 — — — CH0NB CH0SB<3:0> — — — CH0NA CH0SA<3:0> 0000 0000 0000 0000
ADPCFG 02A8 — — — — — — PCFG9 PCFG8 PCFG7 PCFG6 PCFG5 PCFG4 PCFG3 PCFG2 PCFG1 PCFG0 0000 0000 0000 0000
ADCSSL 02AA — — — — — — CSSL9 CSSL8 CSSL7 CSSL6 CSSL5 CSSL4 CSSL3 CSSL2 CSSL1 CSSL0 0000 0000 0000 0000
Legend: u = uninitialized bit; — = unimplemented bit, read as ‘0’
Note: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70139G-page 121
dsPIC30F2011/2012/3012/3013
NOTES:
Wake-up Request
FPLL
OSC1
Primary PLL
Oscillator x4, x8, x16 PLL
OSC2
Lock COSC<2:0>
Primary Osc
Internal FRC Osc
NOSC<2:0>
Primary
Internal Fast RC Oscillator OSWEN
Oscillator (FRC)
Stability Detector
Oscillator
POR Done Start-up
Timer Clock
Programmable
Switching
Secondary Osc Clock Divider System
and Control
Clock
Block
SOSCO
32 kHz LP Secondary 2
Oscillator
Oscillator
SOSCI Stability Detector
POST<1:0>
CF
Fail-Safe Clock
FCKSM<1:0> Monitor (FSCM)
2 Oscillator Trap
To Timer1
The user can switch between these functional groups Byte write is allowed for one instruction cycle. Write the
but cannot switch between options within a group. If the desired value or use bit manipulation instruction.
primary group is selected, then the choice within the To write to the OSCCON high byte, the following
group is always determined by the FPR<4:0> instructions must be executed without any other
Configuration bits. instructions in between:
Byte Write 0x78 to OSCCON high
Byte Write 0x9A to OSCCON high
Byte write is allowed for one instruction cycle. Write the
desired value or use bit manipulation instruction.
RESET
Instruction
Digital
Glitch Filter
MCLR
Sleep or Idle
WDT
Module
Illegal Opcode/
Uninitialized W Register
VDD
MCLR
INTERNAL POR
TOST
OST TIME-OUT
TPWRT
PWRT TIME-OUT
INTERNAL Reset
FIGURE 17-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 17-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
dsPIC30F2011/2012/3012/3013
SFR
Address 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 LVDEN LVDL<3:0> EXTR SWR SWDTEN WDTO SLEEP IDLE BOR POR (Note 1)
OSCCON 0742 — COSC<2:0> — NOSC<2:0> POST<1:0> LOCK — CF — LPOSCEN OSWEN (Note 2)
OSCTUN 0744 — — — — — — — — — — — — TUN3 TUN2 TUN1 TUN0 (Note 2)
PMD1 0770 — — T3MD T2MD T1MD — — — I2CMD U2MD(3) U1MD — SPI1MD — — ADCMD 0000 0000 0000 0000
PMD2 0772 — — — — — — IC2MD IC1MD — — — — — — OC2MD OC1MD 0000 0000 0000 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Reset state depends on type of reset.
2: Reset state depends on Configuration bits.
3: Only available on dsPIC30F3013 devices.
†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.
Note: All peripheral electrical characteristics are specified. For exact peripherals available on specific
devices, please refer to the dsPIC30F2011/2012/3012/3013 Sensor Family table on page 4 of
this data sheet.
VDD
LV10
LVDIF
(LVDIF set by hardware)
VDD
Load Condition 1 — for all pins except OSC2 Load Condition 2 — for OSC2
VDD/2
RL Pin CL
VSS
CL Legend:
Pin
RL = 464 Ω
VSS CL = 50 pF for all pins except OSC2
5 pF for OSC2 output
Q4 Q1 Q2 Q3 Q4 Q1
OSC1
OS20
OS30 OS30 OS31 OS31
OS25
CLKO
OS40 OS41
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 Note: Refer to Figure 20-3 for load conditions.
TABLE 20-21: RESET, WATCHDOG TIMER, OSCILLATOR START-UP TIMER, POWER-UP TIMER
AND BROWN-OUT RESET TIMING REQUIREMENTS
Standard Operating Conditions: 2.5V to 5.5V
(unless otherwise stated)
AC CHARACTERISTICS
Operating temperature -40°C ≤TA ≤+85°C for Industrial
-40°C ≤TA ≤+125°C for Extended
Param
Symbol Characteristic(1) Min Typ(2) Max Units Conditions
No.
SY10 TmcL MCLR Pulse Width (low) 2 — — μs -40°C to +85°C
SY11 TPWRT Power-up Timer Period 2 4 8 ms -40°C to +85°C, VDD =
10 16 32 5V
43 64 128 User programmable
SY12 TPOR Power On Reset Delay 3 10 30 μs -40°C to +85°C
SY13 TIOZ I/O high impedance from MCLR — 0.8 1.0 μs
Low or Watchdog Timer Reset
SY20 TWDT1 Watchdog Timer Time-out Period 1.1 2.0 6.6 ms VDD = 2.5V
TWDT2 (No Prescaler) 1.2 2.0 5.0 ms VDD = 3.3V, ±10%
TWDT3 1.3 2.0 4.0 ms VDD = 5V, ±10%
SY25 TBOR Brown-out Reset Pulse Width(3) 100 — — μs VDD ≤VBOR (D034)
SY30 TOST Oscillation Start-up Timer Period — 1024 TOSC — — TOSC = OSC1 period
SY35 TFSCM Fail-Safe Clock Monitor Delay — 500 900 μs -40°C to +85°C
Note 1: These parameters are characterized but not tested in manufacturing.
2: Data in “Typ” column is at 5V, 25°C unless otherwise stated.
3: Refer to Figure 20-2 and Table 20-11 for BOR.
VBGAP
0V
TxCK
Tx10 Tx11
Tx15 Tx20
OS60
TMRX
TABLE 20-25: TYPE C TIMER (TIMER3 AND TIMER5) EXTERNAL CLOCK TIMING REQUIREMENTS
Standard Operating Conditions: 2.5V to 5.5V
(unless otherwise stated)
AC CHARACTERISTICS
Operating temperature -40°C ≤TA ≤+85°C for Industrial
-40°C ≤TA ≤+125°C for Extended
Param
Symbol Characteristic Min Typ Max Units Conditions
No.
TC10 TtxH TxCK High Time Synchronous 0.5 TCY + 20 — — ns Must also meet
parameter TC15
TC11 TtxL TxCK Low Time Synchronous 0.5 TCY + 20 — — ns Must also meet
parameter TC15
TC15 TtxP TxCK Input Period Synchronous, TCY + 10 — — ns N = prescale
no prescaler value
Synchronous, Greater of: (1, 8, 64, 256)
with prescaler 20 ns or
(TCY + 40)/N
TC20 TCKEXTMRL Delay from External TxCK Clock 0.5 TCY — 1.5 —
Edge to Timer Increment TCY
Note: Timer3 and Timer5 are Type C.
ICX
IC10 IC11
IC15
OCx
(Output Compare
or PWM Mode) OC11 OC10
OC20
OCFA/OCFB
OC15
OCx
SCKx
(CKP = 0)
SCKx
(CKP = 1)
SP31 SP30
SP40 SP41
SCKX
(CKP = 1)
SP35
SP20 SP21
SP40 SP30,SP31
SSX
SP50 SP52
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP72 SP73
SP35
SP30,SP31 SP51
SP41
SP40
Note: Refer to Figure 20-3 for load conditions.
SP50 SP52
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP35
SP72 SP73
SP52
SP30,SP31 SP51
SDIX
MSb IN BIT 14 - - - -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
eoc
AD61
AD60
TSAMP AD55
DONE
ADIF
ADRES(0)
1 2 3 4 5 6 7 8 9
XXXXXXXXXXXXXXXXX dsPIC30F3012
XXXXXXXXXXXXXXXXX 30I/P e3
YYWWNNN 0610017
XXXXXXXXXXXX dsPIC30F2011
XXXXXXXXXXXX 30I/SO e3
XXXXXXXXXXXX
YYWWNNN 0610017
XXXXXXXXXXXXXXXXX dsPIC30F2012
XXXXXXXXXXXXXXXXX 30I/SP e3
YYWWNNN 0610017
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.
XXXXXXXXXXXXXXXXXXXX dsPIC30F3013
XXXXXXXXXXXXXXXXXXXX 30I/SO e3
XXXXXXXXXXXXXXXXXXXX
YYWWNNN 0610017
XXXXXXX 30F2011
XXXXXXX 30I/MM e3
YYWWNNN 0610017
XXXXXXXXXX dsPIC
XXXXXXXXXX 30F3013
XXXXXXXXXX 30I/ML e3
YYWWNNN 0610017
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
NOTE 1
E1
1 2 3
D
A A2
L c
A1
b1
b e eB
6&! 7,8.
'!
9'&! 7 7: ;
7"')
%! 7 <
& 1,
&
& = =
##4
4!! -
1!&
& = =
"# &
"# >#& . - - -
##4>#& . <
: 9& <<
&
& 9 -
9#
4!! <
6 9#>#& ) ?
9
* 9#>#& ) <
:
*+ 1 = = -
!"#$%&" ' ()"&'"!&)
&#*&&&#
+%&, & !&
- '!
!#.#
&"#'
#%!
& "!
!
#%!
& "!
!!
&$#/ !#
'!
#&
.0
1,2 1!'!
&$& "!
**&
"&&
!
* ,1
! "
!" #$ %&' !"(
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
E1
NOTE 1
1 2 3
e
b
α
h
h
c
φ
A A2
β
A1 L
L1
& I B = <B
9#
4!! = --
9#>#& ) - =
# %&
D B = B
# %&1
&&
' E B = B
!"#$%&" ' ()"&'"!&)
&#*&&&#
+%&, & !&
- '!
!#.#
&"#'
#%!
& "!
!
#%!
& "!
!!
&$#'' !#
'!
#&
.0
1,2 1!'!
&$& "!
**&
"&&
!
.32 % '!
("!"*&
"&&
(%
%
'&
"
!!
* ,1
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
) !*
!
!
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
N
NOTE 1
E1
1 2 3
A A2
L c
A1 b1
b e eB
6&! 7,8.
'!
9'&! 7 7: ;
7"')
%! 7 <
& 1,
&
& = =
##4
4!! -
1!&
& = =
"# &
"# >#& . - --
##4>#& . <
: 9& - -?
&
& 9 -
9#
4!! <
6 9#>#& )
9
* 9#>#& ) <
:
*+ 1 = = -
!"#$%&" ' ()"&'"!&)
&#*&&&#
+%&, & !&
- '!
!#.#
&"#'
#%!
& "!
!
#%!
& "!
!!
&$#/ !#
'!
#&
.0
1,2 1!'!
&$& "!
**&
"&&
!
* ,1
)
! "
!" #$ %&' !"(
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
D
N
E
E1
NOTE 1
1 2 3
e
b
h
α
h
φ c
A A2
L
A1 L1 β
&
I B = <B
9#
4!! < = --
9#>#& ) - =
# %&
D B = B
# %&1
&&
' E B = B
!"#$%&" ' ()"&'"!&)
&#*&&&#
+%&, & !&
- '!
!#.#
&"#'
#%!
& "!
!
#%!
& "!
!!
&$#'' !#
'!
#&
.0
1,2 1!'!
&$& "!
**&
"&&
!
.32 % '!
("!"*&
"&&
(%
%
'&
"
!!
* ,1
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
)
+ ,
$
*- .. /0/0&1 +,!
2
3 &4 (
-
3
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
D D2
EXPOSED
PAD
E2
E
b
2 2
1 1 K
N N
L
NOTE 1 BOTTOM VIEW
TOP VIEW
A3 A1
* ,1
)
+ ,
$
*- .. /0/0&1 +,!
2
3 &4 (
-
3
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
44
+ ,
$
*- . 0 +,
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
D D2
EXPOSED
PAD
E2
b
2 2
1 1
N N K
NOTE 1 L
A3 A1
* ,-1
44
+ ,
$
*- . 0 +,
3
&'
!&" &4# *!(!!&
4%&
&#&
&&255***'
'54
U
UART Module
Address Detect Mode ............................................... 109
Auto-Baud Support ................................................... 109
Baud Rate Generator................................................ 109
Enabling and Setting Up ........................................... 107
Framing Error (FERR)............................................... 109
Idle Status ................................................................. 109
Loopback Mode ........................................................ 109
Operation During CPU Sleep and Idle Modes .......... 110
Overview ................................................................... 105
Parity Error (PERR) .................................................. 109
Receive Break........................................................... 109
Receive Buffer (UxRXB) ........................................... 108
Receive Buffer Overrun Error (OERR Bit) ................ 108
Receive Interrupt....................................................... 108
Receiving Data.......................................................... 108
Receiving in 8-bit or 9-bit Data Mode........................ 108
Reception Error Handling.......................................... 108
Transmit Break.......................................................... 108
Transmit Buffer (UxTXB)........................................... 107
Transmit Interrupt...................................................... 108
Transmitting Data...................................................... 107
Transmitting in 8-bit Data Mode................................ 107
Transmitting in 9-bit Data Mode................................ 107
UART1 Register Map................................................ 111
UART2 Register Map................................................ 111
UART Operation
Idle Mode .................................................................. 110
Sleep Mode............................................................... 110
Unit ID Locations............................................................... 123
Universal Asynchronous Receiver Transmitter
(UART) Module ......................................................... 105
W
Wake-up from Sleep ......................................................... 123
Wake-up from Sleep and Idle ............................................. 70
Watchdog Timer
Timing Characteristics .............................................. 165
Timing Requirements................................................ 165
Watchdog Timer (WDT) ............................................ 123, 133
Enabling and Disabling ............................................. 133
Operation .................................................................. 133
WWW Address.................................................................. 205
WWW, On-Line Support ....................................................... 9
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 3 0 1 3 AT- 3 0 I / S P - E S
Custom ID (3 digits) or
Trademark Engineering Sample (ES)
Architecture
Package
P = DIP
Flash
SO = SOIC
SP = SPDIP
Memory Size in Bytes ML = QFN (8x8)
0 = ROMless MM = QFN-S (6x6)
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
Speed
9 = 769K and Up
20 = 20 MIPS
30 = 30 MIPS
Device ID T = Tape and Reel
Example:
dsPIC30F3013AT-30I/SP = 30 MIPS, Industrial temp., SPDIP package, Rev. A
08/04/10