Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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-666-1
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.
Peripheral Features:
Note: This data sheet summarizes features of
this group of dsPIC30F devices and is not • High-Current Sink/Source I/O Pins: 25 mA/25 mA
intended to be a complete reference • Up to Five 16-Bit Timers/Counters; Optionally Pair
source. For more information on the CPU, Up
peripherals, register descriptions and 16-Bit Timers into 32-Bit Timer modules
general device functionality, refer to the
• Up to Four 16-Bit Capture Input Functions
“dsPIC30F Family Reference Manual”
• Up to Four 16-Bit Compare/PWM Output Functions
(DS70046). For more information on the
device instruction set and programming, • Data Converter Interface (DCI) Supports Common
refer to the “16-bit MCU and DSC Pro- Audio Codec Protocols, Including I2S and AC’97
grammer’s Reference Manual” • 3-Wire SPI module (supports 4 Frame modes)
(DS70157). • I2C™ module Supports Multi-Master/Slave mode
and 7-Bit/10-Bit Addressing
High-Performance Modified RISC CPU: • Up to Two Addressable UART modules with FIFO
Buffers
• Modified Harvard Architecture
• CAN bus module Compliant with CAN 2.0B
• C Compiler Optimized Instruction Set Architecture Standard
• Flexible Addressing modes
• 83 Base Instructions Analog Features:
• 24-Bit Wide Instructions, 16-Bit Wide Data Path
• 12-Bit Analog-to-Digital Converter (ADC) with:
• Up to 48 Kbytes On-Chip Flash Program Space
- 200 ksps conversion rate
• 2 Kbytes of On-Chip Data RAM
- Up to 13 input channels
• 1 Kbyte of Nonvolatile Data EEPROM
- Conversion available during Sleep and Idle
• 16 x 16-Bit Working Register Array
• Programmable Low-Voltage Detection (PLVD)
• Up to 30 MIPS Operation:
• Programmable Brown-out Reset
- DC to 40 MHz External Clock Input
- 4 MHz-10 MHz Oscillator Input with
Special Microcontroller Features:
PLL Active (4x, 8x, 16x)
• Up to 33 Interrupt Sources: • Enhanced Flash Program Memory:
- 8 user-selectable priority levels - 10,000 erase/write cycle (min.) for
- 3 external interrupt sources industrial temperature range, 100K (typical)
- 4 processor traps • Data EEPROM Memory:
- 100,000 erase/write cycle (min.) for
DSP Features: industrial temperature range, 1M (typical)
• Self-Reprogrammable under Software Control
• Dual Data Fetch
• Power-on Reset (POR), Power-up Timer (PWRT)
• Modulo and Bit-Reversed modes and Oscillator Start-up Timer (OST)
• Two 40-Bit Wide Accumulators with Optional • Flexible Watchdog Timer (WDT) with On-Chip
saturation Logic Low-Power RC Oscillator for Reliable Operation
• 17-Bit x 17-Bit Single-Cycle Hardware • Fail-Safe Clock Monitor Operation:
Fractional/Integer Multiplier
- Detects clock failure and switches to on-chip
• All DSP Instructions are Single Cycle low-power RC oscillator
- Multiply-Accumulate (MAC) Operation • Programmable Code Protection
• Single-Cycle ±16 Shift • In-Circuit Serial Programming™ (ICSP™)
• Selectable Power Management modes:
- Sleep, Idle and Alternate Clock modes
UART
I2C™
CAN
SRAM EEPROM Timer Input Codec A/D 12-Bit
SPI
Device Pins Comp/
Bytes Instructions Bytes Bytes 16-Bit Cap Interface 200 Ksps
Std PWM
dsPIC30F3014 40/44 24K 8K 2048 1024 3 2 2 — 13 ch 2 1 1 0
dsPIC30F4013 40/44 48K 16K 2048 1024 5 4 4 AC’97, I2S 13 ch 2 1 1 1
Pin Diagrams
40-Pin PDIP
MCLR 1 40 AVDD
AN0/VREF+/CN2/RB0 2 39 AVss
AN1/VREF-/CN3/RB1 3 38 AN9/RB9
AN2/SS1/LVDIN/CN4/RB2 4 37 AN10/RB10
AN3/CN5/RB3 5 36 AN11/RB11
AN4/CN6/RB4 6 35 AN12/RB12
dsPIC30F3014
AN5/CN7/RB5 7 34 EMUC2/OC1/RD0
PGC/EMUC/AN6/OCFA/RB6 8 33 EMUD2/OC2/RD1
PGD/EMUD/AN7/RB7 9 32 VDD
AN8/RB8 10 31 Vss
VDD 11 30 RF0
Vss 12 29 RF1
OSC1/CLKI 13 28 U2RX/CN17/RF4
OSC2/CLKO/RC15 14 27 U2TX/CN18/RF5
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13 15 26 U1RX/SDI1/SDA/RF2
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14 16 25 EMUD3/U1TX/SDO1/SCL/RF3
INT0/RA11 17 24 EMUC3/SCK1/RF6
IC2/INT2/RD9 18 23 IC1/INT1/RD8
RD3 19 22 RD2
Vss 20 21 VDD
40-Pin PDIP
MCLR 1 40 AVDD
AN0/VREF+/CN2/RB0 2 39 AVSS
AN1/VREF-/CN3/RB1 3 38 AN9/CSCK/RB9
AN2/SS1/LVDIN/CN4/RB2 4 37 AN10/CSDI/RB10
AN3/CN5/RB3 5 36 AN11/CSDO/RB11
AN4/IC7/CN6/RB4 6 35 AN12/COFS/RB12
dsPIC30F4013
AN5/IC8/CN7/RB5 7 34 EMUC2/OC1/RD0
PGC/EMUC/AN6/OCFA/RB6 8 33 EMUD2/OC2/RD1
PGD/EMUD/AN7/RB7 9 32 VDD
AN8/RB8 10 31 VSS
VDD 11 30 C1RX/RF0
VSS 12 29 C1TX/RF1
OSC1/CLKI 13 28 U2RX/CN17/RF4
OSC2/CLKO/RC15 14 27 U2TX/CN18/RF5
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13 15 26 U1RX/SDI1/SDA/RF2
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14 16 25 EMUD3/U1TX/SDO1/SCL/RF3
INT0/RA11 17 24 EMUC3/SCK1/RF6
IC2/INT2/RD9 18 23 IC1/INT1/RD8
OC4/RD3 19 22 OC3/RD2
VSS 20 21 VDD
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
EMUD3/U1TX/SDO1/SCL/RF3
EMUC3/SCK1/RF6
IC2/INT2/RD9
IC1/NT1/RD8
INT0/RA11
RD2
RD3
VDD
VSS
NC
44
43
42
41
40
39
38
37
36
35
34
U1RX/SDI1/SDA/RF2 1 33 NC
U2TX/CN18/RF5 2 32 EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
U2RX/CN17/RF4 3 31 OSC2/CLKO/RC15
RF1 4 30 OSC1/CLKI
RF0 5 29 VSS
VSS 6 dsPIC30F3014 28 VDD
VDD 7 27 AN8/RB8
EMUD2/OC2/RD1 8 26 PGD/EMUD/AN7/RB7
EMUC2/OC1/RD0 9 25 PGC/EMUC/AN6/OCFA/RB6
AN12/RB12 10 24 AN5/CN7/RB5
AN11/RB11 11 23 AN4/CN6/RB4
12
13
14
15
16
17
18
19
20
21
22
NC
NC
MCLR
AN10/RB10
AN9/RB9
AN0/VREF+/CN2/RB0
AN1/VREF-/CN3/RB1
AN3/CN5/RB3
AVSS
AVDD
AN2/SS1/LVDIN/CN4/RB2
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
EMUD3/U1TX/SDO1/SCL/RF3
EMUC3/SCK1/RF6
IC1/INT1/RD8
IC2/INT2/RD9
INT0/RA11
RD2
RD3
VDD
VSS
44
43
42
41
40
39
38
37
36
35
34
U1RX/SDI1/SDA/RF2 1 33 OSC2/CLKO/RC15
U2TX/CN18/RF5 2 32 OSC1/CLKI
U2RX/CN17/RF4 3 31 VSS
RF1 4 30 VSS
RF0 5 29 VDD
VSS 6 dsPIC30F3014 28 VDD
VDD 7 27 AN8/RB8
VDD 8 26 PGD/EMUD/AN7/RB7
EMUD2/OC2/RD1 9 25 PGC/EMUC/AN6/OCFA/RB6
EMUC2/OC1/RD0 10 24 AN5/CN7/RB5
AN12/RB12 11 23 AN4/CN6/RB4
12
13
14
15
16
17
18
19
20
21
22
AN0/VREF+/CN2/RB0
AN1/VREF-/CN3/RB1
AN3/CN5/RB3
AN11/RB11
AN10/RB10
AN9/RB9
NC
MCLR
AVDD
AVSS
AN2/SS1/LVDIN/CN4/RB2
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.
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
EMUD3/U1TX/SDO1/SCL/RF3
EMUC3/SCK1/RF6
IC1/INT1/RD8
IC2/INT2/RD9
INT0/RA11
OC3/RD2
OC4/RD3
VDD
VSS
NC
44
43
42
41
40
39
38
37
36
35
34
U1RX/SDI1/SDA/RF2 1 33 NC
U2TX/CN18/RF5 2 32 EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
U2RX/CN17/RF4 3 31 OSC2/CLKO/RC15
C1TX/RF1 4 30 OSC1/CLKI
C1RX/RF0 5 29 VSS
VSS 6 dsPIC30F4013 28 VDD
VDD 7 27 AN8/RB8
EMUD2/OC2/RD1 8 26 PGD/EMUD/AN7/RB7
EMUC2/OC1/RD0 9 25 PGC/EMUC/AN6/OCFA/RB6
AN12/COFS/RB12 10 24 AN5/IC8/CN7/RB5
AN11/CSDO/RB11 11 23 AN4/IC7/CN6/RB4
12
13
14
15
16
17
18
19
20
21
22
AN0/VREF+/CN2/RB0
AN9/CSCK/RB9
AN1/VREF-/CN3/RB1
AN3/CN5/RB3
AN10/CSDI/RB10
NC
NC
MCLR
AVDD
AVSS
AN2/SS1/LVDIN/CN4/RB2
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
EMUD3/U1TX/SDO1/SCL/RF3
EMUC3/SCK1/RF6
IC2/INT2/RD9
IC1/NT1/RD8
INT0/RA11
OC3/RD2
OC4/RD3
VDD
VSS
44
43
42
41
40
39
38
37
36
35
34
U1RX/SDI1/SDA/RF2 1 33 OSC2/CLKO/RC15
U2TX/CN18/RF5 2 32 OSC1/CLKI
U2RX/CN17/RF4 3 31 VSS
C1TX/RF1 4 30 VSS
C1RX/RF0 5 29 VDD
VSS 6 dsPIC30F4013 28 VDD
VDD 7 27 AN8/RB8
VDD 8 26 PGD/EMUD/AN7/RB7
EMUD2/OC2/RD1 9 25 PGC/EMUC/AN6/OCFA/RB6
EMUC2/OC1/RD0 10 24 AN5/IC8/CN7/RB5
AN12/COFS/RB12 11 23 AN4/IC7/CN6/RB4
12
13
14
15
16
17
18
19
20
21
22
AN0/VREF+/CN2/RB0
AN11/CSDO/RB11
AN10/CSDI/RB10
AN9/CSCK/RB9
AN1/VREF-/CN3/RB1
AN3/CN5/RB3
NC
MCLR
AVSS
AVDD
AN2/SS1/LVDIN/CN4/RB2
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.
PORTB
IR
16 16
EMUD1/SOSCI/T2CK/U1ATX/
16 x 16 CN1/RC13
W Reg Array EMUC1/SOSCO/T1CK/U1ARX/
Decode
CN0/RC14
Instruction
Decode and 16 16 OSC2/CLKO/RC15
Control PORTC
Control Signals DSP
to Various Blocks Divide
Power-up Engine Unit
Timer
OSC1/CLKI Timing Oscillator EMUC2/OC1/RD0
Generation Start-up Timer EMUD2/OC2/RD1
POR/BOR ALU<16> RD2
Reset RD3
16 16 IC1/INT1/RD8
MCLR Watchdog IC2/INT2/RD9
Timer
Low-Voltage
VDD, VSS Detect PORTD
AVDD, AVSS
Input Output RF0
12-Bit ADC Capture Compare I2C™ RF1
Module Module U1RX/SDI1/SDA/RF2
EMUD3/U1TX/SDO1/SCL/RF3
U2RX/CN17/RF4
U2TX/CN18/RF5
EMUC3/SCK1/RF6
UART1,
Timers SPI1 UART2 PORTF
Y Data Bus
X Data Bus
16 16 16
16
Interrupt Data Latch Data Latch INT0/RA11
Controller PSV & Table
Data Access Y Data X Data
24 Control Block 8 16 RAM RAM
(1 Kbyte) (1 Kbyte)
Address Address PORTA
24 Latch Latch
16 16 16
24 X RAGU AN0/VREF+/CN2/RB0
Y AGU
PCU PCH PCL X WAGU AN1/VREF-/CN3/RB1
Program Counter AN2/SS1/LVDIN/CN4/RB2
Stack Loop 16
Address Latch AN3/CN5/RB3
Control Control
Program Memory Logic Logic AN4/IC7/CN6/RB4
(48 Kbytes) AN5/IC8/CN7/RB5
PGC/EMUC/AN6/OCFA/RB6
Data EEPROM PGD/EMUD/AN7/RB7
(1 Kbyte) Effective Address AN8/RB8
Data Latch 16 AN9/CSCK/RB9
AN10/CSDI/RB10
AN11/CSDO/RB11
ROM Latch 16 AN12/COFS/RB12
24
PORTB
IR
16 16
EMUD1/SOSCI/T2CK/U1ATX/
16 x 16 CN1/RC13
W Reg Array EMUC1/SOSCO/T1CK/U1ARX/
Decode
CN0/RC14
Instruction
Decode & 16 16 OSC2/CLKO/RC15
Control
PORTC
Control Signals DSP
to Various Blocks Divide
Power-up Engine Unit
Timer
EMUC2/OC1/RD0
OSC1/CLKI Timing Oscillator EMUD2/OC2/RD1
Generation Start-up Timer OC3/RD2
POR/BOR ALU<16> OC4/RD3
Reset IC1/INT1/RD8
16 16 IC2/INT2/RD9
MCLR Watchdog
Timer
Low-Voltage PORTD
VDD, VSS Detect
AVDD, AVSS
This section contains a brief overview of the CPU Overhead-free circular buffers (Modulo Addressing)
architecture of the dsPIC30F. are supported in both X and Y address spaces. This is
primarily intended to remove the loop overhead for
The core has a 24-bit instruction word. The Program DSP algorithms.
Counter (PC) is 23 bits wide with the Least Significant
bit (LSb) always clear (refer to Section 3.1 “Program The X AGU also supports Bit-Reversed Addressing on
Address Space”), and the Most Significant bit (MSb) destination effective addresses to greatly simplify input
is ignored during normal program execution, except for or output data reordering for radix-2 FFT algorithms.
certain specialized instructions. Thus, the PC can Refer to Section 4.0 “Address Generator Units” for
address up to 4M instruction words of user program details on Modulo and Bit-Reversed Addressing.
space. An instruction prefetch mechanism is used to The core supports Inherent (no operand), Relative,
help maintain throughput. Program loop constructs, Literal, Memory Direct, Register Direct, Register
free from loop count management overhead, are Indirect, Register Offset and Literal Offset Addressing
supported using the DO and REPEAT instructions, both modes. Instructions are associated with predefined
of which are interruptible at any point. addressing modes, depending upon their functional
The working register array consists of 16-bit x 16-bit requirements.
registers, each of which can act as data, address or off- For most instructions, the core is capable of executing
set registers. One working register (W15) operates as a data (or program data) memory read, a working reg-
a Software Stack Pointer for interrupts and calls. ister (data) read, a data memory write and a program
The data space is 64 Kbytes (32K words) and is split (instruction) memory read per instruction cycle. As a
into two blocks, referred to as X and Y data memory. result, 3-operand instructions are supported, allowing
Each block has its own independent Address Genera- C = A+B operations to be executed in a single cycle.
tion Unit (AGU). Most instructions operate solely A DSP engine has been included to significantly
through the X memory, AGU, which provides the enhance the core arithmetic capability and throughput. It
appearance of a single, unified data space. The features a high-speed, 17-bit x 17-bit multiplier, a 40-bit
Multiply-Accumulate (MAC) class of dual source DSP ALU, two 40-bit saturating accumulators and a 40-bit
instructions operate through both the X and Y AGUs, bidirectional barrel shifter. Data in the accumulator, or
splitting the data address space into two parts (see any working register, can be shifted up to 15 bits right, or
Section 3.2 “Data Address Space”). The X and Y 16 bits left in a single cycle. The DSP instructions oper-
data space boundary is device-specific and cannot be ate seamlessly with all other instructions and have been
altered by the user. Each data word consists of 2 bytes, designed for optimal real-time performance. The MAC
and most instructions can address data either as words class of instructions can concurrently fetch two data
or bytes. operands from memory while multiplying two W
registers. To enable this concurrent fetching of data
operands, the data space has been split for these
instructions and linear is for all others. This has been
achieved in a transparent and flexible manner by
dedicating certain working registers to each address
space for the MAC class of instructions.
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
X Data Bus
40
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 multipli- The adder has an additional saturation block which
cation, the data is represented as a two’s complement controls accumulator data saturation if selected. It uses
fraction, where the MSB is defined as a sign bit and the the result of the adder, the overflow Status bits
radix point is implied to lie just after the sign bit (QX for- described above, and the SATA/B (CORCON<7:6>)
mat). The range of an N-bit two’s complement fraction and ACCSAT (CORCON<4>) mode control bits to
with this implied radix point is -1.0 to (1 – 21-N). For a determine when and to what value to saturate.
16-bit fraction, the Q15 data range is -1.0 (0x8000) to Six STATUS register bits have been provided to
0.999969482 (0x7FFF) including ‘0’ and has a preci- support saturation and overflow. They are:
sion of 3.01518x10-5. In Fractional mode, the 16x16 1. OA:
multiply operation generates a 1.31 product, which has AccA overflowed into guard bits
a precision of 4.65661 x 10-10.
2. OB:
The same multiplier is used to support the MCU multi- AccB overflowed into guard bits
ply instructions, which includes integer 16-bit signed, 3. SA:
unsigned and mixed sign multiplies. AccA saturated (bit 31 overflow and saturation)
The MUL instruction can be directed to use byte or or
word-sized operands. Byte operands direct a 16-bit AccA overflowed into guard bits and saturated
result, and word operands direct a 32-bit result to the (bit 39 overflow and saturation)
specified register(s) in the W array. 4. SB:
AccB saturated (bit 31 overflow and saturation)
2.4.2 DATA ACCUMULATORS AND or
ADDER/SUBTRACTER AccB overflowed into guard bits and saturated
The data accumulator consists of a 40-bit adder/ (bit 39 overflow and saturation)
subtracter with automatic sign extension logic. It can 5. OAB:
select one of two accumulators (A or B) as its pre- Logical OR of OA and OB
accumulation source and post-accumulation 6. SAB:
destination. For the ADD and LAC instructions, the data Logical OR of SA and SB
to be accumulated or loaded can be optionally scaled
The OA and OB bits are modified each time data
via the barrel shifter prior to accumulation.
passes through the adder/subtracter. When set, they
indicate that the most recent operation has overflowed
into the accumulator guard bits (bits 32 through 39).
The OA and OB bits can also optionally generate an
arithmetic warning trap when set and the correspond-
ing overflow trap flag enable bit (OVATE, OVBTE) in
the INTCON1 register (refer to Section 8.0 “Inter-
rupts”) is set. This allows the user to take immediate
action, for example, to correct system gain.
Vector Tables
3.1 Program Address Space 00007E
Reserved 000080
The program address space is 4M instruction words. It
is addressable by a 24-bit value from either the 23-bit 000084
User Memory
PC, table instruction Effective Address (EA) or data Alternate Vector Table
Space
space EA, when program space is mapped into data 0000FE
space as defined by Table 3-1. Note that the program 000100
space address is incremented by two between succes- User Flash
sive program words in order to provide compatibility Program Memory
(16K instructions)
with data space addressing.
007FFE
008000
FIGURE 3-1: dsPIC30F3014 PROGRAM Reserved
(Read ‘0’s)
SPACE MEMORY MAP 7FFBFE
7FFC00
Reset – GOTO Instruction Data EEPROM
000000
Reset – Target Address 000002 (1 Kbyte)
000004 7FFFFE
Vector Tables
8005FE
0000FE
800600
Space
000100
Space
User Flash
Program Memory Reserved
(8K instructions)
003FFE
004000 F7FFFE
Reserved Device Configuration F80000
(Read ‘0’s) Registers F8000E
7FFBFE F80010
7FFC00
Data EEPROM Reserved
(1 Kbyte)
7FFFFE FEFFFE
800000 FF0000
DEVID (2) FF0002
Reserved
8005BE
8005C0
Configuration Memory
Reserved
F7FFFE
Device Configuration F80000
Registers F8000E
F80010
Reserved
FEFFFE
FF0000
DEVID (2) FF0002
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)
Program Memory TBLRDL.W
‘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 15 LSbs of data space
VISIBILITY addresses directly map to the 15 LSbs in the corre-
sponding program space addresses. The remaining
The upper 32 Kbytes of data space may optionally be bits are provided by the Program Space Visibility Page
mapped into any 16K word program space page. This register, PSVPAG<7:0>, as shown in Figure 3-6.
provides transparent access of stored constant data
from X data space without the need to use special Note: PSV access is temporarily disabled during
instructions (i.e., TBLRDL/H, TBLWTL/H instructions). table reads/writes.
Program space access through the data space occurs For instructions that use PSV which are executed
if the MSb of the data space, EA, is set and program outside a REPEAT loop:
space visibility is enabled by setting the PSV bit in the
• The following instructions require one instruction
Core Control register (CORCON). The functions of
cycle in addition to the specified execution time:
CORCON are discussed in Section 2.4 “DSP
Engine”. - MAC class of instructions with data operand
prefetch
Data accesses to this area add an additional cycle to
- MOV instructions
the instruction being executed, since two program
memory fetches are required. - MOV.D instructions
• All other instructions require two instruction cycles
Note that the upper half of addressable data space is
in addition to the specified execution time of the
always part of the X data space. Therefore, when a
instruction.
DSP operation uses program space mapping to access
this memory region, Y data space should typically con- For instructions that use PSV which are executed
tain state (variable) data for DSP operations, whereas inside a REPEAT loop:
X data space should typically contain coefficient • The following instances require two instruction
(constant) data. cycles in addition to the specified execution time
Although each data space address, 0x8000 and higher, of the instruction:
maps directly into a corresponding program memory - Execution in the first iteration
address (see Figure 3-6), only the lower 16 bits of the - Execution in the last iteration
24-bit program word are used to contain the data. The - Execution prior to exiting the loop due to an
upper 8 bits should be programmed to force an illegal interrupt
instruction to maintain machine robustness. Refer to
- Execution upon re-entering the loop after an
the “16-bit MCU and DSC Programmer’s Reference
interrupt is serviced
Manual” (DS70157) for details on instruction encoding.
• Any other iteration of the REPEAT loop allows 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 0x000200
15
Note: 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).
The memory map shown here is for a dsPIC30F4013 device.
MSB LSB
Address 16 bits Address
MSB LSB
0x0001 0x0000
2 Kbyte SFR Space
SFR Space 0x07FE
0x07FF
0x0801 0x0800
8 Kbyte
X Data RAM (X) Near
2 Kbyte 0x0BFF 0x0BFE Data
0x0C01 0x0C00 Space
SRAM 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
dsPIC30F3014/4013
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’
1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F3014/4013
DS70138G-page 35
dsPIC30F3014/4013
NOTES:
Byte
Address MOV #0x800,W0
MOV W0,XMODSRT ;set modulo start address
MOV #0x863,W0
MOV W0,MODEND ;set modulo end address
0x0800 MOV #0x8001,W0
MOV W0,MODCON ;enable W1, X AGU for modulo
Pivot Point
XB = 0x0008 for a 16-word Bit-Reversed Buffer
A3 A2 A1 A0 Decimal A3 A2 A1 A0 Decimal
0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 1 0 0 0 8
0 0 1 0 2 0 1 0 0 4
0 0 1 1 3 1 1 0 0 12
0 1 0 0 4 0 0 1 0 2
0 1 0 1 5 1 0 1 0 10
0 1 1 0 6 0 1 1 0 6
0 1 1 1 7 1 1 1 0 14
1 0 0 0 8 0 0 0 1 1
1 0 0 1 9 1 0 0 1 9
1 0 1 0 10 0 1 0 1 5
1 0 1 1 11 1 1 0 1 13
1 1 0 0 12 0 0 1 1 3
1 1 0 1 13 1 0 1 1 11
1 1 1 0 14 0 1 1 1 7
1 1 1 1 15 1 1 1 1 15
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 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F3014/4013
DS70138G-page 47
dsPIC30F3014/4013
NOTES:
Read TRIS
I/O Cell
TRIS Latch
Data Bus D Q
WR TRIS CK
Data Latch
D Q I/O Pad
WR LAT +
WR PORT CK
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 +
CK
WR PORT
Data Latch
Read LAT
Input Data
Read PORT
7.2 Configuring Analog Port Pins 7.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) is
converted. EXAMPLE 7-1: PORT WRITE/READ
When the PORT register is read, all pins configured as EXAMPLE
analog input channels are read as cleared (a low level). MOV 0xFF00, W0 ; Configure PORTB<15:8>
Pins configured as digital inputs will not convert an ; as inputs
MOV W0, TRISB ; and PORTB<7:0> as outputs
analog input. Analog levels on any pin that is defined as
NOP ; additional instruction
a digital input (including the ANx pins) may cause the
cycle
input buffer to consume current that exceeds the BTSS PORTB, #11 ; bit test RB11 and skip if set
device specifications.
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
dsPIC30F3014/4013
DS70138G-page 55
dsPIC30F3014/4013
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 (COS) 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 CN9, CN17 and
CN18) that may be selected (enabled) for generating
an interrupt request on a Change-Of-State.
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
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 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F3014/4013
DS70138G-page 57
dsPIC30F3014/4013
NOTES:
Note 1: The natural order priority scheme has 0 16 24 INT1 – External Interrupt 1
as the highest priority and 53 as the 17-22 25-30 Reserved
lowest priority. 23 31 INT2 – External Interrupt 2
2: The natural order priority number is the 24 32 U2RX – UART2 Receiver
same as the INT number. 25 33 U2TX – UART2 Transmitter
The ability for the user to assign every interrupt to one 26 34 Reserved
of seven priority levels means that the user can assign 27 35 C1 – Combined IRQ for CAN1
a very high overall priority level to an interrupt with a
low natural order priority. For example, the PLVD (Pro- 28-41 36-49 Reserved
grammable Low-Voltage Detect) can be given a priority 42 50 LVD – Low-Voltage Detect
of 7. The INT0 (External Interrupt 0) may be assigned 43-53 51-61 Reserved
to priority Level 1, thus giving it a very low effective
Lowest Natural Order Priority
priority.
Reserved 0x000080
Reserved 0x000082
Reserved 0x000084 PC<15:0> W15 (before CALL)
Oscillator Fail Trap Vector SRL IPL3 PC<22:16>
Stack Error Trap Vector <Free Word> W15 (after CALL)
AIVT
Address Error Trap Vector
Math Error Trap Vector POP : [--W15]
Reserved Vector
PUSH: [W15++]
Reserved Vector
Reserved Vector
Interrupt 0 Vector 0x000094
Interrupt 1 Vector
Note 1: The user can always lower the priority
—
—
level by writing a new value into SR. The
— Interrupt Service Routine must clear the
Interrupt 52 Vector interrupt flag bits in the IFSx register
Interrupt 53 Vector 0x0000FE
before lowering the processor interrupt
priority, in order to avoid recursive
interrupts.
2: The IPL3 bit (CORCON<3>) is always
clear when interrupts are being pro-
cessed. It is set only during execution of
traps.
The RETFIE (return from interrupt) instruction unstacks
the program counter and STATUS registers to return
the processor to its state prior to the interrupt
sequence.
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 — — — — C1IF — 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 — — — — C1IE — 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> 0100 0100 0100 0100
IPC5 009E — INT2IP<2:0> — — — — — — — — — — — — 0100 0100 0100 0100
IPC6 00A0 — C1IP<2:0> — — — — — U2TXIP<2:0> — U2RXIP<2:0> 0100 0100 0100 0100
IPC7 00A2 — — — — — — — — — — — — — — — — 0100 0100 0100 0100
IPC8 00A4 — — — — — — — — — — — — — — — — 0100 0100 0100 0100
IPC9 00A6 — — — — — — — — — — — — — — — — 0000 0100 0100 0100
IPC10 00A8 — — — — — LVDIP<2:0> — DCIIP<2:0> — — — — 0000 0100 0100 0000
dsPIC30F3014/4013
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70138G-page 65
TABLE 8-4: dsPIC30F4013 INTERRUPT CONTROLLER REGISTER MAP(1)
DS70138G-page 66
dsPIC30F3014/4013
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 — — — — C1IF — U2TXIF U2RXIF INT2IF T5IF T4IF OC4IF OC3IF IC8IF IC7IF INT1IF 0000 0000 0000 0000
IFS2 0088 — — — — — LVDIF DCIIF — — — — — — — — — 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 — — — — C1IE — U2TXIE U2RXIE INT2IE T5IE T4IE OC4IE OC3IE IC8IE IC7IE INT1IE 0000 0000 0000 0000
IEC2 0090 — — — — — LVDIE DCIIE — — — — — — — — — 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> — IC8IP<2:0> — IC7IP<2:0> — INT1IP<2:0> 0100 0100 0100 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> — U2TXIP<2:0> — U2RXIP<2:0> 0100 0100 0100 0100
IPC7 00A2 — — — — — — — — — — — — — — — — 0100 0100 0100 0100
IPC8 00A4 — — — — — — — — — — — — — — — — 0100 0100 0100 0100
IPC9 00A6 — — — — — — — — — — — — — — — — 0000 0100 0100 0100
IPC10 00A8 — — — — — LVDIP<2:0> — DCIIP<2:0> — — — — 0000 0100 0100 0000
Legend: — = unimplemented bit, read as ‘0’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
2010 Microchip Technology Inc.
dsPIC30F3014/4013
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
intended to be a complete reference
timer increments on every instruction cycle up to a
source. For more information on the CPU,
match value preloaded into the Period register, PR1,
peripherals, register descriptions and
then 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 upon termination of the CPU Idle
Timer1 module and associated operational modes. mode.
Figure 9-1 depicts the simplified block diagram of the
16-bit Timer1 module. 16-Bit Synchronous Counter Mode: In the 16-Bit
Synchronous Counter mode, the timer increments on
The following sections provide a detailed description the rising edge of the applied external clock signal
including setup and control registers, along with which is synchronized with the internal phase clocks.
associated block diagrams for the operational modes of The timer counts up to a match value preloaded in PR1,
the timers. then resets to ‘0’ and continues.
The Timer1 module is a 16-bit timer which can serve as When the CPU goes into the Idle mode, the timer stops
the time counter for the Real-Time Clock (RTC), or incrementing unless the respective TSIDL bit = 0. If
operate as a free-running interval timer/counter. The TSIDL = 1, the timer module logic resumes the incre-
16-bit timer has the following modes: menting sequence upon termination of the CPU Idle
• 16-bit Timer 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
Further, the following operational characteristics are every rising edge of the applied external clock signal.
supported: The timer counts up to a match value preloaded in PR1,
• Timer gate operation then resets to ‘0’ and continues.
• Selectable prescaler settings When the timer is configured for the Asynchronous
• Timer operation during CPU Idle and Sleep mode of operation and the CPU goes into the Idle
modes 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 1, 8, 64, 256
Sync 01
SOSCI
TCY 00
Mode
9.5.1 RTC OSCILLATOR OPERATION
During CPU Sleep mode, the timer operates if:
When the TON = 1, TCS = 1 and TGATE = 0, the timer
• The timer module is enabled (TON = 1) and increments on the rising edge of the 32 kHz LP oscilla-
• The timer clock source is selected as external tor output signal, up to the value specified in the Period
(TCS = 1) and register and is then reset to ‘0’.
• The TSYNC bit (T1CON<2>) is asserted to a logic
The TSYNC bit must be asserted to a logic ‘0’
‘0’ which defines the external clock source as (Asynchronous mode) for correct operation.
asynchronous.
Enabling LPOSCEN (OSCCON<1>) disables the nor-
When all three conditions are true, the timer continues mal Timer and Counter modes and enable a timer
to count up to the Period register and is reset to carry-out wake-up event.
0x0000.
When the CPU enters Sleep mode, the RTC continues
When a match between the timer and the Period to operate, provided the 32 kHz external crystal oscilla-
register occurs, an interrupt can be generated if the tor is active and the control bits have not been
respective timer interrupt enable bit is asserted. changed. The TSIDL bit should be cleared to ‘0’ in
order for RTC to continue operation in Idle mode.
9.4 Timer Interrupt
The 16-bit timer has the ability to generate an interrupt- 9.5.2 RTC INTERRUPTS
on-period match. When the timer count matches the When an interrupt event occurs, the respective interrupt
Period register, the T1IF bit is asserted and an interrupt flag, T1IF, is asserted and an interrupt is generated, if
is generated, if enabled. The T1IF bit must be cleared in enabled. The T1IF bit must be cleared in software. The
software. The Timer Interrupt Flag, T1IF, is located in the respective Timer Interrupt Flag, T1IF, is located in the
IFS0 Control register in the interrupt controller. IFS0 register in the interrupt controller.
When the Gated Time Accumulation mode is enabled, Enabling an interrupt is accomplished via the respec-
an interrupt is also generated on the falling edge of the tive timer interrupt enable bit, T1IE. The timer interrupt
gate signal (at the end of the accumulation cycle). enable bit is located in the IEC0 Control register in the
interrupt controller.
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
dsPIC30F3014/4013
DS70138G-page 69
dsPIC30F3014/4013
NOTES:
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
Note: T3CK pin does not exist on dsPIC30F3014/4013 devices. The block diagram shown here illustrates the
schematic of Timer3 as implemented on the dsPIC30F6014 device.
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
dsPIC30F3014/4013
DS70138G-page 75
dsPIC30F3014/4013
NOTES:
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>)
Q CK
TGATE
(T4CON<6>)
TGATE
TCS
TCKPS<1:0>
TON 2
T4CK 1x
Prescaler
Gate 1, 8, 64, 256
Sync 01
TCY 00
Note: Timer Configuration bit, T32 (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
T5CK Sync 1x
Prescaler
01 1, 8, 64, 256
TCY 00
Note: In the dsPIC30F3014 device, there is no T5CK pin. Therefore, in this device the following modes should
not be used for Timer5:
2: TCS = 1 (16-bit counter)
3: TCS = 0, 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
dsPIC30F3014/4013
DS70138G-page 79
dsPIC30F3014/4013
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: 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
dsPIC30F3014/4013
DS70138G-page 83
dsPIC30F3014/4013
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)
or OCFB
From GP (for x = 5, 6, 7 or 8)
Timer Module
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 13.4 Simple PWM Mode
When control bits, OCM<2:0> (OCxCON<2:0>) = 100 When control bits, OCM<2:0> (OCxCON<2:0>) = 110
or 101, the selected output compare channel is config- or 111, the selected output compare channel is config-
ured for one of two Dual Output Compare modes, ured for the PWM mode of operation. When configured
which are: for the PWM mode of operation, OCxR is the main latch
(read-only) and OCxRS is the secondary latch. This
• Single Output Pulse mode
enables glitchless PWM transitions.
• Continuous Output Pulse mode
The user must perform the following steps in order to
13.3.1 SINGLE PULSE MODE configure the output compare module for PWM
operation:
For the user to configure the module for the generation
of a single output pulse, the following steps are 1. Set the PWM period by writing to the appropriate
required (assuming timer is off): Period register.
• Determine instruction cycle time, TCY. 2. Set the PWM duty cycle by writing to the OCxRS
register.
• Calculate desired pulse width value based on TCY.
3. Configure the output compare module for PWM
• Calculate time to Start pulse from timer start value
operation.
of 0x0000.
4. Set the TMRx prescale value and enable the
• Write pulse-width start and stop times into OCxR
timer, TON (TxCON<15>) = 1.
and OCxRS Compare registers (x denotes
channel 1, 2, ...,N). 13.4.1 INPUT PIN FAULT PROTECTION
• Set Timer Period register to value equal to or FOR PWM
greater than value in OCxRS Compare register.
When control bits, OCM<2:0> (OCxCON<2:0>) = 111,
• Set OCM<2:0> = 100.
the selected output compare channel is again config-
• Enable timer, TON (TxCON<15>) = 1. ured for the PWM mode of operation with the additional
To initiate another single pulse, issue another write to feature of input Fault protection. While in this mode, if
set OCM<2:0> = 100. a logic ‘0’ is detected on the OCFA/B pin, the respective
PWM output pin is placed in the high-impedance input
state. The OCFLT bit (OCxCON<4>) indicates whether
a Fault condition has occurred. This state is maintained
until both of the following events have occurred:
• The external Fault condition has been removed.
• The PWM mode has been re-enabled by writing
to the appropriate control bits.
EQUATION 13-1:
PWM period = [(PRx) + 1] • 4 • TOSC •
(TMRx prescale value)
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 OCTSE 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.
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
dsPIC30F3014/4013
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.
DS70138G-page 89
dsPIC30F3014/4013
NOTES:
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
As per the I2C standard, FSCK may be 100 kHz or The master continues 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 is
up to 1 MHz. I2CBRG values of ‘0’ or ‘1’ are illegal. set.
A write to the I2CTRN starts the transmission of data at
EQUATION 14-1: SERIAL CLOCK RATE the first data bit, regardless of where the transmitter left
off when bus collision occurred.
In a multi-master environment, the interrupt generation
I2CBRG = ( FFSCK
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 deasserts the cleared.
SCL pin (SCL allowed to float high) during any receive,
transmit, or Restart/Stop condition. When the SCL pin 14.13 I2C Module Operation During CPU
is allowed to float high, the Baud Rate Generator Sleep and Idle Modes
(BRG) is suspended from counting until the SCL pin is
actually sampled high. When the SCL pin is sampled 14.13.1 I2C OPERATION DURING CPU
high, the Baud Rate Generator is reloaded with the SLEEP MODE
contents of I2CBRG and begins counting. This ensures
that the SCL high time is always at least one BRG roll- When the device enters Sleep mode, all clock sources
over count in the event that the clock is held low by an to the module are shut down and stay at logic ‘0’. If
external device. Sleep occurs in the middle of a transmission and the
state machine is partially into a transmission as the
14.12.5 MULTI-MASTER COMMUNICATION, clocks stop, then the transmission is aborted. Similarly,
BUS COLLISION AND BUS if Sleep occurs in the middle of a reception, then the
reception is aborted.
ARBITRATION
Multi-master operation support is achieved by bus arbi- 14.13.2 I2C OPERATION DURING CPU IDLE
tration. When the master outputs address/data bits MODE
onto the SDA pin, arbitration takes place when the
For the I2C, the I2CSIDL bit determines if the module
master outputs a ‘1’ on SDA by letting SDA float high
stops or continues on Idle. If I2CSIDL = 0, the module
while another master asserts a ‘0’. When the SCL pin
continues operation on assertion of the Idle mode. If
floats high, data should be stable. If the expected data
I2CSIDL = 1, the module stops 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 sets the MI2CIF pulse and resetS 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
dsPIC30F3014/4013
DS70138G-page 97
dsPIC30F3014/4013
NOTES:
Internal
Data Bus
Read Write
SPIxBUF SPIxBUF
Receive Transmit
SPIxSR
SDIx bit 0
SDOx Shift
Clock
SSx and Clock Edge
FSYNC Control Select
Control
SSx
Secondary Primary
Prescaler Prescaler FCY
1:1-1:8 1:1, 1:4,
SCKx 1:16, 1:64
Note: x = 1 or 2.
SDOx SDIy
Note: x = 1 or 2, y = 1 or 2.
dsPIC30F3014/4013
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.
2010 Microchip Technology Inc.
dsPIC30F3014/4013
16.0 UNIVERSAL ASYNCHRONOUS 16.1 UART Module Overview
RECEIVER TRANSMITTER The key features of the UART module are:
(UART) MODULE • Full-duplex, 8 or 9-bit data communication
Note: This data sheet summarizes features of • Even, odd or no parity options (for 8-bit data)
this group of dsPIC30F devices and is not • One or two Stop bits
intended to be a complete reference • Fully integrated Baud Rate Generator with 16-bit
source. For more information on the CPU, prescaler
peripherals, register descriptions and • Baud rates range from 38 bps to 1.875 Mbps at a
general device functionality, refer to the 30 MHz instruction rate
“dsPIC30F Family Reference Manual”
• 4-word deep transmit data buffer
(DS70046).
• 4-word deep receive data buffer
This section describes the Universal Asynchronous • Parity, framing and buffer overrun error detection
Receiver/Transmitter Communications module. • Support for interrupt only on address detect
(9th bit = 1)
• Separate transmit and receive interrupts
• Loopback mode for diagnostic support
• Two choices of TX/RX pins on UART1 module
Write Write
Load TSR
UxTXIF
UTXBRK
Data
Transmit Shift Register (UxTSR)
‘0’ (Start)
UxTX
or UxATX ‘1’ (Stop)
if ALTIO = 1
Parity 16x Baud Clock
Parity 16 Divider
Generator from Baud Rate
Generator
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
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’
Note 1: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
U2MODE 0216 UARTEN — USIDL — — — — — WAKE LPBACK ABAUD — — PDSEL1 PDSEL0 STSEL 0000 0000 0000 0000
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: Refer to the “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F3014/4013
DS70138G-page 109
dsPIC30F3014/4013
NOTES:
Acceptance Mask
BUFFERS RXM1(2)
Acceptance Filter
RXF2(2)
MESSAGE
MESSAGE
RXF0(2) RXF4(2)
TXLARB
TXLARB
TXLARB
c p
TXREQ
TXREQ
TXREQ
TXERR
TXERR
TXERR
TXABT
TXABT
TXABT
e t
Acceptance Filter Acceptance Filter
p
RXF1(2) RXF5(2)
t
R(2) R(2)
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
dsPIC30F3014/4013
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
2010 Microchip Technology Inc.
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
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
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 17-1: dsPIC30F4013 CAN1 REGISTER MAP(1) (CONTINUED)
2010 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
C1TX1B1 0356 Transmit Buffer 1 Byte 1 Transmit Buffer 1 Byte 0 uuuu uuuu uuuu uuuu
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
dsPIC30F3014/4013
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
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 — CSIDL 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
DS70138G-page 119
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 RX1IE RX0IE 0000 0000 0000 0000
C1EC 039A TERRCNT<7:0> RERRCNT<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.
dsPIC30F3014/4013
NOTES:
Sample Rate
FOSC/4 CSCK
Generator
FSD
Word-Size Selection bits Frame
Frame Length Selection bits Synchronization COFS
DCI Mode Selection bits Generator
16-Bit Data Bus
Receive Buffer
Registers w/Shadow
DCI Buffer
Control Unit
15 0
Transmit Buffer
DCI Shift Register CSDI
Registers w/Shadow
CSDO
CSCK
COFS
BIT_CLK
SYNC
CSCK
WS
Note: A 5-bit transfer is shown here for illustration purposes. The I2S protocol does not specify word length – this
will be system dependent.
dsPIC30F3014/4013
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
DCICON1 0240 DCIEN — DCISIDL — DLOOP CSCKD CSCKE COFSD UNFM CSDOM DJST — — — COFSM1 COFSM0 0000 0000 0000 0000
DCICON2 0242 — — — — BLEN1 BLEN0 — COFSG<3:0> — WS<3:0> 0000 0000 0000 0000
DCICON3 0244 — — — — BCG<11:0> 0000 0000 0000 0000
DCISTAT 0246 — — — — SLOT3 SLOT2 SLOT1 SLOT0 — — — — ROV RFUL TUNF TMPTY 0000 0000 0000 0000
TSCON 0248 TSE15 TSE14 TSE13 TSE12 TSE11 TSE10 TSE9 TSE8 TSE7 TSE6 TSE5 TSE4 TSE3 TSE2 TSE1 TSE0 0000 0000 0000 0000
RSCON 024C RSE15 RSE14 RSE13 RSE12 RSE11 RSE10 RSE9 RSE8 RSE7 RSE6 RSE5 RSE4 RSE3 RSE2 RSE1 RSE0 0000 0000 0000 0000
RXBUF0 0250 Receive Buffer 0 Data Register 0000 0000 0000 0000
RXBUF1 0252 Receive Buffer 1 Data Register 0000 0000 0000 0000
RXBUF2 0254 Receive Buffer 2 Data Register 0000 0000 0000 0000
RXBUF3 0256 Receive Buffer 3 Data Register 0000 0000 0000 0000
TXBUF0 0258 Transmit Buffer 0 Data Register 0000 0000 0000 0000
TXBUF1 025A Transmit Buffer 1 Data Register 0000 0000 0000 0000
TXBUF2 025C Transmit Buffer 2 Data Register 0000 0000 0000 0000
TXBUF3 025E Transmit Buffer 3 Data Register 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.
2010 Microchip Technology Inc.
dsPIC30F3014/4013
19.0 12-BIT ANALOG-TO-DIGITAL The A/D module has six 16-bit registers:
CONVERTER (ADC) MODULE • A/D Control Register 1 (ADCON1)
• A/D Control Register 2 (ADCON2)
Note: This data sheet summarizes features of • A/D Control Register 3 (ADCON3)
this group of dsPIC30F devices and is not
intended to be a complete reference • A/D Input Select Register (ADCHS)
source. For more information on the CPU, • A/D Port Configuration Register (ADPCFG)
peripherals, register descriptions and • A/D Input Scan Selection Register (ADCSSL)
general device functionality, refer to the
The ADCON1, ADCON2 and ADCON3 registers
“dsPIC30F Family Reference Manual”
control the operation of the A/D module. The ADCHS
(DS70046).
register selects the input channels to be converted. The
The 12-bit Analog-to-Digital Converter (ADC) allows ADPCFG register configures the port pins as analog
conversion of an analog input signal to a 12-bit digital inputs or as digital I/O. The ADCSSL register selects
number. This module is based on a Successive inputs for scanning.
Approximation Register (SAR) architecture and pro- Note: The SSRC<2:0>, ASAM, SMPI<3:0>,
vides a maximum sampling rate of 200 ksps. The A/D BUFM and ALTS bits, as well as the
module has up to 16 analog inputs which are multi-
ADCON3 and ADCSSL registers, must
plexed into a sample and hold amplifier. The output of
not be written to while ADON = 1. This
the sample and hold is the input into the converter
would lead to indeterminate results.
which generates the result. The analog reference volt-
age is software selectable to either the device supply The block diagram of the 12-bit A/D module is shown in
voltage (AVDD/AVSS) or the voltage level on the Figure 19-1.
(VREF+/VREF-) pin. The A/D converter has a unique
feature of being able to operate while the device is in
Sleep mode with RC oscillator selection.
VREF+
VREF-
0000 Comparator
AN0
DAC
0001
AN1
0010
AN2
0011 12-Bit SAR Conversion Logic
AN3
0100
AN4
Format
Data
0110
AN6
0111
AN7
1000 Sample/Sequence
AN8 Sample Control
1001
AN9
1010 Input
AN10 Input MUX
Switches
1011 Control
AN11
1100
AN12
VREF- S/H CH0
AN1
Note: The ADCHS, ADPCFG and ADCSSL registers allow the application to configure AN13-AN15 as analog input
pins. Since these pins are not physically present on the device, conversion results from these pins will read ‘0’.
TAD Sampling
Speed Rs Max VDD Temperature Channels Configuration
Minimum Time Min
Up to 200 334 ns 1 TAD 2.5 k 4.5V to -40°C to +85°C
VREF-VREF+
ksps(1) 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 19-2 for recommended
circuit.
See Note 1
44
43
42
41
40
39
38
37
36
35
34
1 33 VDD VDD VDD
2 32
C8 C7 C6
3 VSS 31 1 F 0.1 F 0.01 F
4 VSS 30
5 VDD 29 VDD
dsPIC30F3014
6 VSS VDD 28
VDD 7 VDD 27
8 VDD 26
AVDD AVDD AVDD
9 25
19 VREF+
20 VREF-
17 AVDD
16 AVSS
10 24 C5 C4 C3
11 23 1 F 0.1 F 0.01 F
12
13
14
15
18
21
VDD 22
R2 R1
10 VDD 10
C2 C1
0.1 F 0.01 F
Note 1: Ensure adequate bypass capacitors are provided on each VDD pin.
The configuration procedures below give the required • Configure the ADC clock period to be:
setup values for the conversion speeds above 1
100 ksps. = 334 ns
(14 + 1) x 200,000
19.7.1 200 ksps CONFIGURATION by writing to the ADCS<5:0> control bits in the
GUIDELINE ADCON3 register.
The following configuration items are required to • Configure the sampling time to be 1 TAD by
achieve a 200 ksps conversion rate. writing: SAMC<4:0> = 00001.
• Comply with conditions provided in Table 19-2. The following figure shows the timing diagram of the
• Connect external VREF+ and VREF- pins following ADC running at 200 ksps. The TAD selection in conjunc-
the recommended circuit shown in Figure 19-2. tion with the guidelines described above allows a con-
version speed of 200 ksps. See Example 19-1 for code
• Set SSRC<2.0> = 111 in the ADCON1 register to
example.
enable the auto-convert option.
• Enable automatic sampling by setting the ASAM
control bit in the ADCON1 register.
• Write the SMPI<3.0> control bits in the ADCON2
register for the desired number of conversions
between interrupts.
TSAMP TSAMP
= 1 TAD = 1 TAD
ADCLK
TCONV TCONV
= 14 TAD = 14 TAD
SAMP
DONE
ADCBUF0
ADCBUF1
19.8 A/D Acquisition Requirements affect the time required to charge the capacitor, CHOLD.
The combined impedance of the analog sources must
The analog input model of the 12-bit A/D converter is therefore be small enough to fully charge the holding
shown in Figure 19-4. The total sampling time for the capacitor within the chosen sample time. To minimize
A/D is a function of the internal amplifier settling time the effects of pin leakage currents on the accuracy of
and the holding capacitor charge time. the A/D converter, the maximum recommended source
For the A/D converter to meet its specified accuracy, impedance, RS, is 2.5 k. After the analog input chan-
the Charge Holding Capacitor (CHOLD) must be nel is selected (changed), this sampling function must
allowed to fully charge to the voltage level on the be completed prior to starting the conversion. The inter-
analog input pin. The Source Impedance (RS), the nal holding capacitor will be in a discharged state prior
Interconnect Impedance (RIC) and the Internal Sam- to each sample operation.
pling Switch (RSS) Impedance combine to directly
VDD
RIC 250 Sampling RSS 3 k
Switch
VT = 0.6V
Rs ANx RSS
CHOLD
VA CPIN ILEAKAGE = 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
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
dsPIC30F3014/4013
ADCHS 02A6 — — — CH0NB CH0SB<3:0> — — — CH0NA CH0SA<3:0> 0000 0000 0000 0000
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.
DS70138G-page 139
dsPIC30F3014/4013
NOTES:
Wake-up Request
FPLL
OSC1
Primary PLL
Oscillator x4, x8, x16 PLL
OSC2
Lock COSC<2:0>
Primary Osc
NOSC<2:0>
Primary
Oscillator OSWEN
Stability Detector
Oscillator
POR Done Start-up
Timer Clock
Programmable
Switching
Secondary Osc Clock Divider System
and Control
Clock
SOSCO Block
32 kHz LP Secondary
Oscillator 2
Oscillator
SOSCI Stability Detector
POST<1:0>
4
TUN<3:0>
Internal Fast RC
Oscillator (FRC)
Internal LPRC
Low-Power RC
Oscillator (LPRC)
CF
Fail-Safe Clock
FCKSM<1:0> Monitor (FSCM)
2 Oscillator Trap
To Timer1
• The current oscillator group bits, COSC<2:0>. Note: When a 16x PLL is used, the FRC
• The LPOSCEN bit (OSCCON register). frequency must not be tuned to a
frequency greater than 7.5 MHz.
The LP oscillator is on (even during Sleep mode) if
LPOSCEN = 1. The LP oscillator is the device clock if:
TABLE 20-4: FRC TUNING
• COSC<2:0> = 00 (LP selected as main osc.) and
TUN<3:0>
• LPOSCEN = 1 FRC Frequency
Bits
Keeping the LP oscillator on at all times allows for a fast
0111 +10.5%
switch to the 32 kHz system clock for lower power
operation. Returning to the faster main oscillator still 0110 +9.0%
requires a start-up time 0101 +7.5%
0100 +6.0%
20.2.4 PHASE LOCKED LOOP (PLL) 0011 +4.5%
The PLL multiplies the clock which is generated by the 0010 +3.0%
primary oscillator. The PLL is selectable to have either 0001 +1.5%
gains of x4, x8 and x16. Input and output frequency 0000 Center Frequency (oscillator is
ranges are summarized in Table 20-3. running at calibrated frequency)
TABLE 20-3: PLL FREQUENCY RANGE 1111 -1.5%
1110 -3.0%
PLL
FIN FOUT 1101 -4.5%
Multiplier
1100 -6.0%
4 MHz-10 MHz x4 16 MHz-40 MHz 1011 -7.5%
4 MHz-10 MHz x8 32 MHz-80 MHz 1010 -9.0%
4 MHz-7.5 MHz x16 64 MHz-120 MHz 1001 -10.5%
The PLL features a lock output which is asserted when 1000 -12.0%
the PLL enters a phase locked state. Should the loop
fall out of lock (e.g., due to noise), the lock signal is 20.2.6 LOW-POWER RC OSCILLATOR (LPRC)
rescinded. The state of this signal is reflected in the The LPRC oscillator is a component of the Watchdog
read-only LOCK bit in the OSCCON register. Timer (WDT) and oscillates at a nominal frequency of
512 kHz. The LPRC oscillator is the clock source for
20.2.5 FAST RC OSCILLATOR (FRC) the Power-up Timer (PWRT) circuit, WDT and clock
The FRC oscillator is a fast (7.37 MHz ±2% nominal) monitor circuits. It may also be used to provide a low-
internal RC oscillator. This oscillator is intended to pro- frequency clock source option for applications where
vide reasonable device operating speeds without the power consumption is critical and timing accuracy is
use of an external crystal, ceramic resonator, or RC not required.
network. The FRC oscillator can be used with the PLL The LPRC oscillator is always enabled at a Power-on
to obtain higher clock frequencies.
Reset because it is the clock source for the PWRT.
The dsPIC30F operates from the FRC oscillator when- After the PWRT expires, the LPRC oscillator remains
ever the current oscillator selection control bits in the on if one of the following is TRUE:
OSCCON register (OSCCON<14:12>) are set to ‘001’.
• The Fail-Safe Clock Monitor is enabled
The four-bit field specified by TUN<3:0> • The WDT is enabled
(OSCTUN<3:0>) allows the user to tune the internal • The LPRC oscillator is selected as the system
fast RC oscillator (nominal 7.37 MHz). The user can clock via the COSC<2:0> control bits in the
tune the FRC oscillator within a range of +10.5%
OSCCON register
(840 kHz) and -12% (960 kHz) in steps of 1.50%
around the factory-calibrated setting (see Table 20-4). If one of the above conditions is not true, the LPRC
shuts off after the PWRT expires.
Note: OSCTUN functionality has been provided
to help customers compensate for Note 1: OSC2 pin function is determined by the
temperature effects on the FRC frequency Primary Oscillator mode selection
over a wide range of temperatures. The (FPR<4:0>).
tuning step size is an approximation and is 2: OSC1 pin cannot be used as an I/O pin
neither characterized nor tested. even if the secondary oscillator or an
internal clock source is selected at all
times.
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Legend:
R = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’
-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown
Digital
Glitch Filter
MCLR
Sleep or Idle
WDT
Module
Illegal Opcode/
Uninitialized W Register
20.4.1 POR: POWER-ON RESET The POR circuit inserts a small delay, TPOR, which is
nominally 10 s and ensures that the device bias
A power-on event generates an internal POR pulse
circuits are stable. Furthermore, a user-selected
when a VDD rise is detected. The Reset pulse occurs at
power-up time-out (TPWRT) is applied. The TPWRT
the POR circuit threshold voltage (VPOR) which is nom-
parameter is based on device Configuration bits and
inally 1.85V. The device supply voltage characteristics
can be 0 ms (no delay), 4 ms, 16 ms, or 64 ms. The
must meet specified starting voltage and rise rate
total delay is at device power-up, TPOR + TPWRT. When
requirements. The POR pulse resets a POR timer and
these delays have expired, SYSRST is negated on the
places the device in the Reset state. The POR also
next leading edge of the Q1 clock and the PC jumps to
selects the device clock source identified by the
the Reset vector.
oscillator configuration fuses.
The timing for the SYSRST signal is shown in
Figure 20-3 through Figure 20-5.
VDD
MCLR
INTERNAL POR
TOST
OST TIME-OUT
TPWRT
PWRT TIME-OUT
INTERNAL Reset
FIGURE 20-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 20-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
20.4.1.2 Operating without FSCM and PWRT FIGURE 20-6: EXTERNAL POWER-ON
If the FSCM is disabled and the Power-up Timer RESET CIRCUIT (FOR
(PWRT) is also disabled, then the device exits rapidly SLOW VDD POWER-UP)
from Reset on power-up. If the clock source is FRC,
LPRC, ERC or EC, it will be active immediately. VDD
dsPIC30F3014/4013
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 LVDEN LVDL<3:0> EXTR SWR SWDTEN WDTO SLEEP IDLE BOR POR (Note 2)
OSCCON 0742 — COSC<2:0> — NOSC<2:0> POST<1:0> LOCK — CF — LPOSCEN OSWEN (Note 3)
OSCTUN 0744 — — — — — — — — — — — — TUN3 TUN2 TUN1 TUN0 0000 0000 0000 0000
PMD1 0770 T5MD(4) T4MD(4) T3MD T2MD T1MD — — DCIMD(4) I2CMD U2MD U1MD — SPI1MD — C1MD ADCMD 0000 0000 0000 0000
PMD2 0772 IC8MD(4) IC7MD(4) — — — — IC2MD IC1MD — — — — OC4MD(4) OC3MD(4) 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.
2: Reset state depends on type of Reset.
3: Reset state depends on Configuration bits.
4: These bits are not available in dsPIC30F3014 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 dsPIC30F3014/4013 Controller Family table.
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
Legend:
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 calibrated at 7.372 MHz ±2%, 25°C and 5V. TUN bits (OSCCON<3:0>) 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
Oscillator
Time-out
Internal
Reset
Watchdog
Timer
Reset
SY20
SY13
SY13
I/O Pins
SY35
FSCM
Delay
VBGAP
0V
Band Gap
SY40 Stable
TxCK
Tx10 Tx11
Tx15 Tx20
OS60
TMRX
TABLE 23-24: 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 1: Timer3 and Timer5 are Type C.
ICX
IC10 IC11
IC15
OCx
(Output Compare
or PWM Mode) OC11 OC10
OC20
OCFA/OCFB
OC15
OCx
CSCK
(SCKE = 0)
CSCK
(SCKE = 1)
CS20 CS21
COFS
CS55 CS56
CS35
CS51 CS50 70
CS30 CS31
CS40 CS41
BIT_CLK
(CSCK)
CS71 CS70
CS72
SYNC
(COFS)
CS76 CS75
CS80
SDIx MSb In
(CSDI)
CS65 CS66
SCKx
(CKP = 0)
SCKx
(CKP = 1)
SP31 SP30
SP40 SP41
FIGURE 23-15: SPI MODULE MASTER MODE (CKE =1) TIMING CHARACTERISTICS
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 23-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
XXXXXXXXXXXXXXXXXX dsPIC30F4013
XXXXXXXXXXXXXXXXXX -30I/P e3
XXXXXXXXXXXXXXXXXX
YYWWNNN 0810017
XXXXXXXXXX dsPIC
XXXXXXXXXX 30F4013
XXXXXXXXXX -301/PT e3
YYWWNNN 0810017
XXXXXXXXXX dsPIC
XXXXXXXXXX 30F4013
XXXXXXXXXX -30I/ML e3
YYWWNNN 0810017
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.
NOTE 1
E1
1 2 3
A A2
L c
b1
A1
b e eB
8QLWV ,1&+(6
'LPHQVLRQ/LPLWV 0,1 120 0$;
1XPEHURI3LQV 1
3LWFK H %6&
7RSWR6HDWLQJ3ODQH $ ± ±
0ROGHG3DFNDJH7KLFNQHVV $ ±
%DVHWR6HDWLQJ3ODQH $ ± ±
6KRXOGHUWR6KRXOGHU:LGWK ( ±
0ROGHG3DFNDJH:LGWK ( ±
2YHUDOO/HQJWK ' ±
7LSWR6HDWLQJ3ODQH / ±
/HDG7KLFNQHVV F ±
8SSHU/HDG:LGWK E ±
/RZHU/HDG:LGWK E ±
2YHUDOO5RZ6SDFLQJ H% ± ±
1RWHV
3LQYLVXDOLQGH[IHDWXUHPD\YDU\EXWPXVWEHORFDWHGZLWKLQWKHKDWFKHGDUHD
6LJQLILFDQW&KDUDFWHULVWLF
'LPHQVLRQV'DQG(GRQRWLQFOXGHPROGIODVKRUSURWUXVLRQV0ROGIODVKRUSURWUXVLRQVVKDOOQRWH[FHHGSHUVLGH
'LPHQVLRQLQJDQGWROHUDQFLQJSHU$60(<0
%6& %DVLF'LPHQVLRQ7KHRUHWLFDOO\H[DFWYDOXHVKRZQZLWKRXWWROHUDQFHV
D
D1
E
e
E1
N
b
NOTE 1 1 2 3
NOTE 2
A α
c φ
β A1 A2
L L1
8QLWV 0,//,0(7(56
'LPHQVLRQ/LPLWV 0,1 120 0$;
1XPEHURI/HDGV 1
/HDG3LWFK H %6&
2YHUDOO+HLJKW $ ± ±
0ROGHG3DFNDJH7KLFNQHVV $
6WDQGRII $ ±
)RRW/HQJWK /
)RRWSULQW / 5()
)RRW$QJOH
2YHUDOO:LGWK ( %6&
2YHUDOO/HQJWK ' %6&
0ROGHG3DFNDJH:LGWK ( %6&
0ROGHG3DFNDJH/HQJWK ' %6&
/HDG7KLFNQHVV F ±
/HDG:LGWK E
0ROG'UDIW$QJOH7RS
0ROG'UDIW$QJOH%RWWRP
1RWHV
3LQYLVXDOLQGH[IHDWXUHPD\YDU\EXWPXVWEHORFDWHGZLWKLQWKHKDWFKHGDUHD
&KDPIHUVDWFRUQHUVDUHRSWLRQDOVL]HPD\YDU\
'LPHQVLRQV'DQG(GRQRWLQFOXGHPROGIODVKRUSURWUXVLRQV0ROGIODVKRUSURWUXVLRQVVKDOOQRWH[FHHGPPSHUVLGH
'LPHQVLRQLQJDQGWROHUDQFLQJSHU$60(<0
%6& %DVLF'LPHQVLRQ7KHRUHWLFDOO\H[DFWYDOXHVKRZQZLWKRXWWROHUDQFHV
5() 5HIHUHQFH'LPHQVLRQXVXDOO\ZLWKRXWWROHUDQFHIRULQIRUPDWLRQSXUSRVHVRQO\
0LFURFKLS 7HFKQRORJ\ 'UDZLQJ &%
D D2
EXPOSED
PAD
E2
b
2 2
1 1
N N K
NOTE 1 L
A3 A1
8QLWV 0,//,0(7(56
'LPHQVLRQ/LPLWV 0,1 120 0$;
1XPEHURI3LQV 1
3LWFK H %6&
2YHUDOO+HLJKW $
6WDQGRII $
&RQWDFW7KLFNQHVV $ 5()
2YHUDOO:LGWK ( %6&
([SRVHG3DG:LGWK (
2YHUDOO/HQJWK ' %6&
([SRVHG3DG/HQJWK '
&RQWDFW:LGWK E
&RQWDFW/HQJWK /
&RQWDFWWR([SRVHG3DG . ± ±
1RWHV
3LQYLVXDOLQGH[IHDWXUHPD\YDU\EXWPXVWEHORFDWHGZLWKLQWKHKDWFKHGDUHD
3DFNDJHLVVDZVLQJXODWHG
'LPHQVLRQLQJDQGWROHUDQFLQJSHU$60(<0
%6& %DVLF'LPHQVLRQ7KHRUHWLFDOO\H[DFWYDOXHVKRZQZLWKRXWWROHUDQFHV
5() 5HIHUHQFH'LPHQVLRQXVXDOO\ZLWKRXWWROHUDQFHIRULQIRUPDWLRQSXUSRVHVRQO\
Updated the Pinout I/O Descriptions for AVDD and AVSS (see Table 1-1).
Section 20.0 “System Integration” Added a note on OSCTUN functionality in Section 20.2.5 “Fast RC
Oscillator (FRC)”.
• XTL
• XT w/PLL 16x
• HS/2 w/PLL 4x, 8x, and 16x
• HS/3 w/PLL 4x, 8x, and 16x
• EC w/PLL 4x, 8x, and 16x
Section 23.0 “Electrical Updated the maximum value for parameter DI19 and the minimum value for
Characteristics” parameter DI29 in the I/O Pin Input Specifications (see Table 23-8).
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 4 0 1 3 AT - 3 0 I / P T- E S
Custom ID (3 digits) or
Trademark Engineering Sample (ES)
Architecture
Package
P = 40-pin PDIP
Flash PT = 44-pin TQFP (10x10)
ML = 44-pin QFN (8x8)
Memory Size in Bytes S = Die (Waffle Pack)
0 = ROMless W = Die (Wafers)
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:
dsPIC30F4013AT-30I/PT = 30 MIPS, Industrial temp., TQFP package, Rev. A
08/04/10