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.
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
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
AN0/VREF+/CN2/RB0
AN9/RB9
AN1/VREF-/CN3/RB1
AN3/CN5/RB3
AVSS
AVDD
AN2/SS1/LVDIN/CN4/RB2
Note: For descriptions of individual pins, see Section 1.0 “Device Overview”.
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: For descriptions of individual pins, see Section 1.0 “Device Overview”.
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
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
AN10/CSDI/RB10
AN3/CN5/RB3
NC
NC
MCLR
AVDD
AVSS
AN2/SS1/LVDIN/CN4/RB2
Note: For descriptions of individual pins, see Section 1.0 “Device Overview”.
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
AN11/CSDO/RB11
AN10/CSDI/RB10
AN9/CSCK/RB9
AN0/VREF+/CN2/RB0
AN1/VREF-/CN3/RB1
AN3/CN5/RB3
NC
MCLR
AVSS
AVDD
AN2/SS1/LVDIN/CN4/RB2
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 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/CN6/RB4
(24 Kbytes) AN5/CN7/RB5
PGC/EMUC/AN6/OCFA/RB6
Data EEPROM PGD/EMUD/AN7/RB7
(1 Kbyte) Effective Address AN8/RB8
Data Latch 16 AN9/RB9
AN10/RB10
AN11/RB11
ROM Latch 16 AN12/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 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
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
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
Vector Tables
space as defined by Table 3-1. Note that the program
00007E
space address is incremented by two between succes- Reserved 000080
sive program words in order to provide compatibility 000084
with data space addressing. Alternate Vector Table
0000FE
FIGURE 3-1: dsPIC30F3014 PROGRAM 000100
SPACE MEMORY MAP
Reset – GOTO Instruction 000000 User Flash
User Memory
Reset – Target Address 000002 Program Memory
000004
Space
(16K instructions)
Interrupt Vector Table
Vector Tables
00007E
Reserved 000080
007FFE
000084 004000
Reserved
Alternate Vector Table (Read ‘0’s)
0000FE 7FFBFE
000100 7FFC00
Data EEPROM
User Flash
(1 Kbyte)
Program Memory
(8K instructions) 7FFFFE
800000
User Memory
003FFE
004000 Reserved
Space
Reserved
(Read ‘0’s) 8005BE
Configuration Memory
7FFBFE 8005C0
7FFC00 UNITID (32 instr.)
Data EEPROM 8005FE
(1 Kbyte)
Space
800600
7FFFFE
800000 Reserved
Reserved
8005BE F7FFFE
8005C0 Device Configuration F80000
UNITID (32 instr.) Registers F8000E
8005FE F80010
800600
Reserved
Reserved
Configuration Memory
FEFFFE
FF0000
DEVID (2) FF0002
F7FFFE
Space
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 program memory word, the LS 15 bits of data space
SPACE VISIBILITY addresses directly map to the LS 15 bits 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
- MAC class of instructions with data operand
Engine”.
prefetch
Data accesses to this area add an additional cycle to - MOV instructions
the instruction being executed, since two program
- MOV.D instructions
memory fetches are required.
• 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 “dsPIC30F/33F Programmer’s Reference Manual”
interrupt is serviced
(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 0x000200
15 Concatenation 23
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
Address
SFR Name Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
(Home)
W0 0000 W0/WREG 0000 0000 0000 0000
W1 0002 W1 0000 0000 0000 0000
W2 0004 W2 0000 0000 0000 0000
W3 0006 W3 0000 0000 0000 0000
W4 0008 W4 0000 0000 0000 0000
W5 000A W5 0000 0000 0000 0000
W6 000C W6 0000 0000 0000 0000
W7 000E W7 0000 0000 0000 0000
W8 0010 W8 0000 0000 0000 0000
W9 0012 W9 0000 0000 0000 0000
W10 0014 W10 0000 0000 0000 0000
W11 0016 W11 0000 0000 0000 0000
W12 0018 W12 0000 0000 0000 0000
W13 001A W13 0000 0000 0000 0000
W14 001C W14 0000 0000 0000 0000
W15 001E W15 0000 1000 0000 0000
SPLIM 0020 SPLIM 0000 0000 0000 0000
ACCAL 0022 ACCAL 0000 0000 0000 0000
ACCAH 0024 ACCAH 0000 0000 0000 0000
dsPIC30F3014/4013
ACCAU 0026 Sign Extension (ACCA<39>) ACCAU 0000 0000 0000 0000
ACCBL 0028 ACCBL 0000 0000 0000 0000
ACCBH 002A ACCBH 0000 0000 0000 0000
ACCBU 002C Sign Extension (ACCB<39>) ACCBU 0000 0000 0000 0000
PCL 002E PCL 0000 0000 0000 0000
PCH 0030 — — — — — — — — — PCH 0000 0000 0000 0000
TBLPAG 0032 — — — — — — — — TBLPAG 0000 0000 0000 0000
PSVPAG 0034 — — — — — — — — PSVPAG 0000 0000 0000 0000
RCOUNT 0036 RCOUNT uuuu uuuu uuuu uuuu
DCOUNT 0038 DCOUNT uuuu uuuu uuuu uuuu
DOSTARTL 003A DOSTARTL 0 uuuu uuuu uuuu uuu0
DS70138E-page 33
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)
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
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2007 Microchip Technology Inc.
dsPIC30F3014/4013
4.0 ADDRESS GENERATOR UNITS 4.1.1 FILE REGISTER INSTRUCTIONS
Most file register instructions use a 13-bit address field
Note: This data sheet summarizes features of this group
of dsPIC30F devices and is not intended to be a complete (f) to directly address data present in the first 8192
reference source. For more information on the CPU, bytes of data memory (near data space). Most file
peripherals, register descriptions and general device register instructions employ a working register, W0,
functionality, refer to the “dsPIC30F Family Reference which is denoted as WREG in these instructions. The
Manual” (DS70046). For more information on the device
instruction set and programming, refer to the “dsPIC30F/
destination is typically either the same file register or
33F Programmer’s Reference Manual” (DS70157). WREG (with the exception of the MUL instruction),
which writes the result to a register or register pair. The
The dsPIC DSC core contains two independent MOV instruction allows additional flexibility and can
address generator units: the X AGU and Y AGU. The Y access the entire data space during file register
AGU supports word-sized data reads for the DSP MAC operation.
class of instructions only. The dsPIC DSC AGUs sup-
port three types of data addressing: 4.1.2 MCU INSTRUCTIONS
• Linear Addressing The three-operand MCU instructions are of the form:
• Modulo (Circular) Addressing Operand 3 = Operand 1 <function> Operand 2
• Bit-Reversed Addressing
where Operand 1 is always a working register (i.e., the
Linear and Modulo Data Addressing modes can be addressing mode can only be register direct), which is
applied to data space or program space. Bit-Reversed referred to as Wb. Operand 2 can be a W register,
Addressing is only applicable to data space addresses. fetched from data memory or a 5-bit literal. The result
location can be either a W register or an address
4.1 Instruction Addressing Modes location. The following addressing modes are
supported by MCU instructions:
The addressing modes in Table 4-1 form the basis of
the addressing modes optimized to support the specific • Register Direct
features of individual instructions. The addressing • Register Indirect
modes provided in the MAC class of instructions are • Register Indirect Post-modified
somewhat different from those in the other instruction • Register Indirect Pre-modified
types.
• 5-bit or 10-bit Literal
Note: Not all instructions support all the address-
ing modes given above. Individual
instructions may support different subsets
of these addressing modes.
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
The dsPIC30F family of devices contains internal 5.3 Table Instruction Operation
program Flash memory for executing user code. There
Summary
are two methods by which the user can program this
memory: The TBLRDL and the TBLWTL instructions are used to
1. Run-Time Self-Programming (RTSP) read or write to bits<15:0> of program memory.
TBLRDL and TBLWTL can access program memory in
2. In-Circuit Serial Programming™ (ICSP™)
Word or Byte mode.
5.1 In-Circuit Serial Programming The TBLRDH and TBLWTH instructions are used to read
or write to bits<23:16> of program memory. TBLRDH
(ICSP)
and TBLWTH can access program memory in Word or
dsPIC30F devices can be serially programmed while in Byte mode.
the end application circuit. This is simply done with two A 24-bit program memory address is formed using
lines for Programming Clock and Programming Data bits<7:0> of the TBLPAG register and the Effective
(which are named PGC and PGD, respectively), and Address (EA) from a W register specified in the table
three other lines for Power (VDD), Ground (VSS) and instruction, as shown in Figure 5-1.
Master Clear (MCLR). This allows customers to manu-
facture boards with unprogrammed devices and then
program the microcontroller just before shipping the
product. This also allows the most recent firmware or a
custom firmware to be programmed.
24 bits
Using
Program 0 Program Counter 0
Counter
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
2: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F3014/4013
DS70138E-page 45
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 +
WR Port CK
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
cylcle
input buffer to consume current that exceeds the btss PORTB, #11 ; bit test RB11 and skip if
device specifications. set
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
DS70138E-page 53
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 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 24 exter-
nal signals (CN0 through CN23) that may be selected
(enabled) for generating an interrupt request on a
change of state.
TABLE 7-2: INPUT CHANGE NOTIFICATION REGISTER MAP FOR dsPIC30F3014 (BITS 15-8)
SFR Name Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Reset State
CNEN1 00C0 CN15IE CN14IE CN13IE CN12IE CN11IE CN10IE CN9IE CN8IE 0000 0000 0000 0000
CNEN2 00C2 — — — — — — — — 0000 0000 0000 0000
CNPU1 00C4 CN15PUE CN14PUE CN13PUE CN12PUE CN11PUE CN10PUE CN9PUE CN8PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — — — — 0000 0000 0000 0000
Legend: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 7-3: INPUT CHANGE NOTIFICATION REGISTER MAP FOR dsPIC30F3014 (BITS 7-0)
SFR
Addr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
CNEN1 00C0 CN7IE CN6IE CN5IE CN4IE CN3IE CN2IE CN1IE CN0IE 0000 0000 0000 0000
CNEN2 00C2 — — — — — CN18IE CN17IE CN16IE 0000 0000 0000 0000
CNPU1 00C4 CN7PUE CN6PUE CN5PUE CN4PUE CN3PUE CN2PUE CN1PUE CN0PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — CN18PUE CN17PUE CN16PUE 0000 0000 0000 0000
Legend: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 7-4: INPUT CHANGE NOTIFICATION REGISTER MAP FOR dsPIC30F4013 (BITS 15-8)
SFR
Addr. Bit 15 Bit 14 Bit 13 Bit 12 Bit 11 Bit 10 Bit 9 Bit 8 Reset State
Name
CNEN1 00C0 CN15IE CN14IE CN13IE CN12IE CN11IE CN10IE CN9IE CN8IE 0000 0000 0000 0000
CNEN2 00C2 — — — — — — — — 0000 0000 0000 0000
CNPU1 00C4 CN15PUE CN14PUE CN13PUE CN12PUE CN11PUE CN10PUE CN9PUE CN8PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — — — — 0000 0000 0000 0000
Legend: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 7-5: INPUT CHANGE NOTIFICATION REGISTER MAP FOR dsPIC30F4013 (BITS 7-0)
SFR
Addr. Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Reset State
Name
CNEN1 00C0 CN7IE CN6IE CN5IE CN4IE CN3IE CN2IE CN1IE CN0IE 0000 0000 0000 0000
CNEN2 00C2 CN23IE CN22IE CN21IE CN20IE CN19IE CN18IE CN17IE CN16IE 0000 0000 0000 0000
CNPU1 00C4 CN7PUE CN6PUE CN5PUE CN4PUE CN3PUE CN2PUE CN1PUE CN0PUE 0000 0000 0000 0000
CNPU2 00C6 CN23PUE CN22PUE CN21PUE CN20PUE CN19PUE CN18PUE CN17PUE CN16PUE 0000 0000 0000 0000
Legend: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
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
dsPIC30F3014/4013
IPC10 00A8 — — — — — LVDIP<2:0> — DCIIP<2:0> — — — — 0000 0100 0100 0000
Legend: u = uninitialized bit
2: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70138E-page 61
TABLE 8-4: dsPIC30F4013 INTERRUPT CONTROLLER REGISTER MAP
DS70138E-page 62
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: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2007 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 this group presents a block diagram of the 16-bit timer module.
of dsPIC30F devices and is not intended to be a complete
reference source. For more information on the CPU, 16-bit Timer Mode: In the 16-bit Timer mode, the timer
peripherals, register descriptions and general device increments on every instruction cycle up to a match
functionality, refer to the “dsPIC30F Family Reference value preloaded into the Period register PR1, then
Manual” (DS70046). resets to ‘0’ and continues to count.
This section describes the 16-bit general purpose When the CPU goes into the Idle mode, the timer stops
Timer1 module and associated operational modes. incrementing unless the TSIDL (T1CON<13>) bit = 0.
Figure 9-1 depicts the simplified block diagram of the If TSIDL = 1, the timer module logic resumes the incre-
16-bit Timer1 module. menting sequence upon termination of the CPU Idle
The following sections provide a detailed description mode.
including setup and control registers, along with 16-bit Synchronous Counter Mode: In the 16-bit
associated block diagrams for the operational modes of Synchronous Counter mode, the timer increments on
the timers. the rising edge of the applied external clock signal
The Timer1 module is a 16-bit timer which can serve as which is synchronized with the internal phase clocks.
the time counter for the real-time clock, or operate as a The timer counts up to a match value preloaded in
free-running interval timer/counter. The 16-bit timer PR1, then resets to ‘0’ and continues.
has the following modes: When the CPU goes into the Idle mode, the timer stops
• 16-bit Timer incrementing unless the respective TSIDL bit = 0. If
• 16-bit Synchronous Counter TSIDL = 1, the timer module logic resumes the incre-
menting sequence upon termination of the CPU Idle
• 16-bit Asynchronous Counter
mode.
Further, the following operational characteristics are
16-bit Asynchronous Counter Mode: In the 16-bit
supported:
Asynchronous Counter mode, the timer increments on
• Timer gate operation every rising edge of the applied external clock signal.
• Selectable prescaler settings The timer counts up to a match value preloaded in
• Timer operation during CPU Idle and Sleep PR1, then resets to ‘0’ and continues.
modes When the timer is configured for the Asynchronous
• Interrupt on 16-bit Period register match or falling mode of operation and the CPU goes into the Idle
edge of external gate signal mode, the timer stops incrementing if TSIDL = 1.
PR1
Equal
Comparator x 16 TSYNC
1 Sync
TMR1
Reset
0
0
T1IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
SOSCO/ TON 2
T1CK 1x
Gate Prescaler
LPOSCEN
Sync 01 1, 8, 64, 256
SOSCI
TCY 00
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
The 32-bit timer has the following modes: 32-bit Synchronous Counter Mode: In the 32-bit
Synchronous Counter mode, the timer increments on
• Two independent 16-bit timers (Timer2 and the rising edge of the applied external clock signal
Timer3) with all 16-bit operating modes (except which is synchronized with the internal phase clocks.
Asynchronous Counter mode) The timer counts up to a match value preloaded in the
• Single 32-bit timer operation combined 32-bit period register, PR3/PR2, then resets
• Single 32-bit synchronous counter to ‘0’ and continues.
Further, the following operational characteristics are When the timer is configured for the Synchronous
supported: Counter mode of operation and the CPU goes into the
Idle mode, the timer stops incrementing unless the
• ADC event trigger
TSIDL (T2CON<13>) bit = 0. If TSIDL = 1, the timer
• Timer gate operation module logic resumes the incrementing sequence
• Selectable prescaler settings upon termination of the CPU Idle mode.
• Timer operation during Idle and Sleep modes
• Interrupt on a 32-bit period register match
These operating modes are determined by setting the
appropriate bit(s) in the 16-bit T2CON and T3CON
SFRs.
For 32-bit timer/counter operation, Timer2 is the lsw
and Timer3 is the msw of the 32-bit timer.
Note: For 32-bit timer operation, T3CON control
bits are ignored. Only T2CON control bits
are used for setup and control. Timer2
clock and gate inputs are utilized for the
32-bit timer module, but an interrupt is
generated with the Timer3 interrupt flag
(T3IF) and the interrupt is enabled with the
Timer3 interrupt enable bit (T3IE).
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
DS70138E-page 71
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
Gate Prescaler
01 1, 8, 64, 256
Sync
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:
4: TCS = 1 (16-bit counter)
5: 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
DS70138E-page 75
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
DS70138E-page 79
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.
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)
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
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: u = uninitialized bit
1: Refer to “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
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: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2007 Microchip Technology Inc.
dsPIC30F3014/4013
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 intended to be a complete • I2C slave operation with 7-bit address
reference source. For more information on the CPU,
peripherals, register descriptions and general device
• I2C slave operation with 10-bit address
functionality, refer to the 'dsPIC30F Family Reference • I2C master operation with 7 or 10-bit address
Manual' (DS70046).
See the I2C programmer’s model in Figure 14-1.
2 TM
The Inter-Integrated Circuit (I C ) module provides
complete hardware support for both Slave and Multi- 14.1.2 PIN CONFIGURATION IN I2C MODE
Master modes of the I2C serial communication I2C has a 2-pin interface: the SCL pin is clock and the
standard, with a 16-bit interface. SDA pin is data.
This module offers the following key features:
14.1.3 I2C REGISTERS
• I2C interface supporting both master and slave
operation. I2CCON and I2CSTAT are control and STATUS regis-
• I2C Slave mode supports 7 and 10-bit address. ters, respectively. The I2CCON register is readable and
writable. The lower 6 bits of I2CSTAT are read-only.
• I2C Master mode supports 7 and 10-bit address.
The remaining bits of the I2CSTAT are read/write.
• I2C port allows bidirectional transfers between
master and slaves. I2CRSR is the shift register used for shifting data,
whereas I2CRCV is the buffer register to which data
• Serial clock synchronization for I2C port can be
bytes are written, or from which data bytes are read.
used as a handshake mechanism to suspend and
I2CRCV is the receive buffer as shown in Figure 14-1.
resume serial transfer (SCLREL control).
I2CTRN is the transmit register to which bytes are
• I2C supports multi-master operation; detects bus written during a transmit operation, as shown in
collision and arbitrates accordingly. Figure 14-2.
The I2CADD register holds the slave address. A Status
14.1 Operating Function Description bit, ADD10, indicates 10-bit Address mode. The
The hardware fully implements all the master and slave I2CBRG acts as the Baud Rate Generator reload
functions of the I2C Standard and Fast mode value.
specifications, as well as 7 and 10-bit addressing. In receive operations, I2CRSR and I2CRCV together
Thus, the I2C module can operate either as a slave or form a double-buffered receiver. When I2CRSR
a master on an I2C bus. receives a complete byte, it is transferred to I2CRCV
and an interrupt pulse is generated. During
transmission, the I2CTRN is not double-buffered.
Note: Following a Restart condition in 10-bit
mode, the user only needs to match the
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
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 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 Gener- Sleep and Idle Modes
ator (BRG) is suspended from counting until the SCL
pin is actually sampled high. When the SCL pin is sam- 14.13.1 I2C OPERATION DURING CPU
pled high, the Baud Rate Generator is reloaded with SLEEP MODE
the contents of I2CBRG and begins counting. This
ensures that the SCL high time is always at least one When the device enters Sleep mode, all clock sources
BRG rollover count in the event that the clock is held to the module are shut down and stay at logic ‘0’. If
low by an 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
DS70138E-page 91
dsPIC30F3014/4013
NOTES:
Internal
Data Bus
Read Write
SPIxBUF SPIxBUF
Receive Transmit
SPIxSR
SDIx bit 0
SDOx Shift
Clock
SS 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: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2007 Microchip Technology Inc.
dsPIC30F3014/4013
16.0 UNIVERSAL ASYNCHRONOUS • One or two Stop bits
RECEIVER TRANSMITTER • Fully integrated Baud Rate Generator with 16-bit
prescaler
(UART) MODULE
• Baud rates range from 38 bps to 1.875 Mbps at a
Note: This data sheet summarizes features of this group 30 MHz instruction rate
of dsPIC30F devices and is not intended to be a complete • 4-word deep transmit data buffer
reference source. For more information on the CPU,
peripherals, register descriptions and general device • 4-word deep receive data buffer
functionality, refer to the “dsPIC30F Family Reference • Parity, framing and buffer overrun error detection
Manual” (DS70046).
• Support for interrupt only on address detect
This section describes the Universal Asynchronous (9th bit = 1)
Receiver/Transmitter Communications module. • Separate transmit and receive interrupts
• Loopback mode for diagnostic support
16.1 UART Module Overview • Two choices of TX/RX pins on UART1 module
The key features of the UART module are:
• Full-duplex, 8 or 9-bit data communication
• Even, odd or no parity options (for 8-bit data)
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
1: Refer to “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
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
dsPIC30F3014/4013
DS70138E-page 103
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 — — — — Transmit Buffer 2 Extended Identifier<13:6> uuuu 0000 uuuu uuuu
<17:14>
C1TX2DLC 0344 Transmit Buffer 2 Extended Identifier<5:0> TXRTR TXRB1 TXRB0 DLC<3:0> — — — uuuu uuuu uuuu u000
© 2007 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 — — — — Transmit Buffer 1 Extended Identifier<13:6> uuuu 0000 uuuu uuuu
<17:14>
Legend: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 17-1: dsPIC30F4013 CAN1 REGISTER MAP (CONTINUED)
© 2007 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
C1TX1DLC 0354 Transmit Buffer 1 Extended Identifier<5:0> TXRTR TXRB1 TXRB0 DLC<3:0> — — — uuuu uuuu uuuu u000
C1TX1B1 0356 Transmit Buffer 1 Byte 1 Transmit Buffer 1 Byte 0 uuuu uuuu uuuu uuuu
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 — — — — Transmit Buffer 0 Extended Identifier<13:6> uuuu 0000 uuuu uuuu
<17:14>
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
dsPIC30F3014/4013
C1RX1B3 037A Receive Buffer 1 Byte 5 Receive Buffer 1 Byte 4 uuuu uuuu uuuu uuuu
C1RX1B4 037C Receive Buffer 1 Byte 7 Receive Buffer 1 Byte 6 uuuu uuuu uuuu uuuu
C1RX1CON 037E — — — — — — — — RXFUL — — — RXRTRRO FILHIT<2:0> 0000 0000 0000 0000
C1RX0SID 0380 — — — Receive Buffer 0 Standard Identifier<10:0> SRR RXIDE 000u uuuu uuuu uuuu
C1RX0EID 0382 — — — — Receive Buffer 0 Extended Identifier<17:6> 0000 uuuu uuuu uuuu
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
DS70138E-page 113
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
Legend: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
TABLE 17-1: dsPIC30F4013 CAN1 REGISTER MAP (CONTINUED)
DS70138E-page 114
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
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
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2007 Microchip Technology Inc.
dsPIC30F3014/4013
18.0 DATA CONVERTER 18.2.3 CSDI PIN
INTERFACE (DCI) MODULE The serial data input (CSDI) pin is configured as an
input only pin when the module is enabled.
Note: This data sheet summarizes features of this group
of dsPIC30F devices and is not intended to be a complete 18.2.3.1 COFS PIN
reference source. For more information on the CPU,
peripherals, register descriptions and general device The Codec Frame Synchronization (COFS) pin is used
functionality, refer to the “dsPIC30F Family Reference to synchronize data transfers that occur on the CSDO
Manual” (DS70046).
and CSDI pins. The COFS pin may be configured as an
input or an output. The data direction for the COFS pin
18.1 Module Introduction is determined by the COFSD control bit in the
The dsPIC30F Data Converter Interface (DCI) module DCICON1 register.
allows simple interfacing of devices, such as audio The DCI module accesses the shadow registers while
coder/decoders (Codecs), A/D converters and D/A the CPU is in the process of accessing the memory
converters. The following interfaces are supported: mapped buffer registers.
• Framed Synchronous Serial Transfer (single or
18.2.4 BUFFER DATA ALIGNMENT
multichannel)
• Inter-IC Sound (I2S) Interface Data values are always stored left justified in the buff-
ers since most Codec data is represented as a signed
• AC-Link Compliant mode
2’s complement fractional number. If the received word
The DCI module provides the following general length is less than 16 bits, the unused LSbs in the
features: receive buffer registers are set to ‘0’ by the module. If
• Programmable word size up to 16 bits the transmitted word length is less than 16 bits, the
• Support for up to 16 time slots, for a maximum unused LSbs in the transmit buffer register are ignored
frame size of 256 bits by the module. The word length setup is described in
subsequent sections of this document.
• Data buffering for up to 4 samples without CPU
overhead 18.2.5 TRANSMIT/RECEIVE SHIFT
REGISTER
18.2 Module I/O Pins
The DCI module has a 16-bit shift register for shifting
There are four I/O pins associated with the module. serial data in and out of the module. Data is shifted in/
When enabled, the module controls the data direction out of the shift register MSb first, since audio PCM data
of each of the four pins. is transmitted in signed 2’s complement format.
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
When enabled, the DCI controls the data direction for The operation of the COFSM control bits depends on
the four I/O pins associated with the module. The port, whether the DCI module generates the Frame Sync
LAT and TRIS register values for these I/O pins are signal as a master device, or receives the Frame Sync
overridden by the DCI module when the DCIEN bit is set. signal as a slave device.
It is also possible to override the CSCK pin separately The master device in a DSP/Codec pair is the device
when the bit clock generator is enabled. This permits that generates the Frame Sync signal. The Frame Sync
the bit clock generator to operate without enabling the signal initiates data transfers on the CSDI and CSDO
rest of the DCI module. pins and usually has the same frequency as the data
sample rate (COFS).
18.3.2 WORD-SIZE SELECTION BITS The DCI module is a Frame Sync master if the COFSD
The WS<3:0> word-size selection bits in the DCICON2 control bit is cleared and is a Frame Sync slave if the
SFR determine the number of bits in each DCI data COFSD control bit is set.
word. Essentially, the WS<3:0> bits determine the
counting period for a 4-bit counter clocked from the 18.3.5 MASTER FRAME SYNC
CSCK signal. OPERATION
Any data length, up to 16 bits, may be selected. The When the DCI module is operating as a Frame Sync
value loaded into the WS<3:0> bits is one less the master device (COFSD = 0), the COFSM mode bits
desired word length. For example, a 16-bit data word determine the type of Frame Sync pulse that is
size is selected when WS<3:0> = 1111. generated by the Frame Sync generator logic.
A new COFS signal is generated when the Frame Sync
Note: These WS<3:0> control bits are used only
generator resets to ‘0’.
in the Multichannel and I2S modes. These
bits have no effect in AC-Link mode since In the Multichannel mode, the Frame Sync pulse is
the data slot sizes are fixed by the protocol. driven high for the CSCK period to initiate a data trans-
fer. The number of CSCK cycles between successive
18.3.3 FRAME SYNC GENERATOR Frame Sync pulses depends on the word size and
The Frame Sync generator (COFSG) is a 4-bit counter Frame Sync generator control bits. A timing diagram for
that sets the frame length in data words. The Frame the Frame Sync signal in Multichannel mode is shown
Sync generator is incremented each time the word-size in Figure 18-2.
counter is reset (refer to Section 18.3.2 “Word-Size In the AC-Link mode of operation, the Frame Sync
Selection Bits”). The period for the Frame Synchroni- signal has a fixed period and duty cycle. The AC-Link
zation generator is set by writing the COFSG<3:0> Frame Sync signal is high for 16 CSCK cycles and is
control bits in the DCICON2 SFR. The COFSG period low for 240 CSCK cycles. A timing diagram with the
in clock cycles is determined by the following formula: timing details at the start of an AC-Link frame is shown
in Figure 18-3.
EQUATION 18-1: COFSG PERIOD In the I2S mode, a Frame Sync signal having a 50%
duty cycle is generated. The period of the I2S Frame
Frame Length = Word Length • (FSG Value + 1)
Sync signal in CSCK cycles is determined by the word
size and Frame Sync generator control bits. A new I2S
Frame lengths, up to 16 data words, may be selected. data transfer boundary is marked by a high-to-low or a
The frame length in CSCK periods can vary up to a low-to-high transition edge on the COFS pin.
maximum of 256 depending on the word size that is
selected.
Note: The COFSG control bits have no effect in
AC-Link mode since the frame length is
set to 256 CSCK periods by the protocol.
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: u = uninitialized bit
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
© 2007 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 this group
of dsPIC30F devices and is not intended to be a complete • A/D Control Register 3 (ADCON3)
reference source. For more information on the CPU, • A/D Input Select Register (ADCHS)
peripherals, register descriptions and general device
functionality, refer to the “dsPIC30F Family Reference
• A/D Port Configuration Register (ADPCFG)
Manual” (DS70046). • A/D Input Scan Selection Register (ADCSSL)
The 12-bit Analog-to-Digital Converter (ADC) allows The ADCON1, ADCON2 and ADCON3 registers
conversion of an analog input signal to a 12-bit digital control the operation of the A/D module. The ADCHS
number. This module is based on a Successive register selects the input channels to be converted. The
Approximation Register (SAR) architecture and pro- ADPCFG register configures the port pins as analog
vides a maximum sampling rate of 200 ksps. The A/D inputs or as digital I/O. The ADCSSL register selects
module has up to 16 analog inputs which are multi- inputs for scanning.
plexed into a sample and hold amplifier. The output of Note: The SSRC<2:0>, ASAM, SMPI<3:0>,
the sample and hold is the input into the converter BUFM and ALTS bits, as well as the
which generates the result. The analog reference volt- ADCON3 and ADCSSL registers, must
age is software selectable to either the device supply not be written to while ADON = 1. This
voltage (AVDD/AVSS) or the voltage level on the would lead to indeterminate results.
(VREF+/VREF-) pin. The A/D converter has a unique
feature of being able to operate while the device is in The block diagram of the 12-bit A/D module is shown in
Sleep mode with RC oscillator selection. Figure 19-1.
AVDD
AVSS
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 5.5V -40°C to +85°C
ksps(1)
VREF- VREF+
CHX
ANx
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
22
VDD
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 100 1
ksps. = 334 ns
(14 + 1) x 200,000
19.7.1 200 KSPS CONFIGURATION
GUIDELINE by writing to the ADCS<5:0> control bits in the
The following configuration items are required to ADCON3 register.
achieve a 200 ksps conversion rate. • Configure the sampling time to be 1 TAD by
writing: SAMC<4:0> = 00001.
• Comply with conditions provided in Table 19-2.
• Connect external VREF+ and VREF- pins following The following figure shows the timing diagram of the
the recommended circuit shown in Figure 19-2. ADC running at 200 ksps. The TAD selection in conjunc-
tion with the guidelines described above allows a con-
• Set SSRC<2.0> = 111 in the ADCON1 register to
version speed of 200 ksps. See Example 19-1 for code
enable the auto-convert option.
example.
• 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 required to charge the capacitor CHOLD. The combined
impedance of the analog sources must therefore be
The analog input model of the 12-bit A/D converter is small enough to fully charge the holding capacitor
shown in Figure 19-4. The total sampling time for the A/ within the chosen sample time. To minimize the effects
D is a function of the internal amplifier settling time and of pin leakage currents on the accuracy of the A/D con-
the holding capacitor charge time. verter, the maximum recommended source imped-
For the A/D converter to meet its specified accuracy, ance, RS, is 2.5 kΩ. After the analog input channel is
the charge holding capacitor (CHOLD) must be allowed selected (changed), this sampling function must be
to fully charge to the voltage level on the analog input completed prior to starting the conversion. The internal
pin. The source impedance (RS), the interconnect holding capacitor will be in a discharged state prior to
impedance (RIC), and the internal sampling switch each sample operation.
(RSS) impedance combine to directly affect the time
VDD
RIC ≤ 250Ω Sampling RSS ≤ 3 kΩ
Switch
VT = 0.6V
Rs ANx RSS
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
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
1: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
DS70138E-page 133
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)
CF
Fail-Safe Clock
FCKSM<1:0> Monitor (FSCM)
2 Oscillator Trap
To Timer1
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 power-
when a VDD rise is detected. The Reset pulse occurs at
up time-out (TPWRT) is applied. The TPWRT parameter
the POR circuit threshold voltage (VPOR) which is nom-
is based on device Configuration bits and can be 0 ms
inally 1.85V. The device supply voltage characteristics
(no delay), 4 ms, 16 ms, or 64 ms. The total delay is at
must meet specified starting voltage and rise rate
device power-up, TPOR + TPWRT. When these delays
requirements. The POR pulse resets a POR timer and
have expired, SYSRST is negated on the next leading
places the device in the Reset state. The POR also
edge of the Q1 clock and the PC jumps to the Reset
selects the device clock source identified by the
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
The LVD module is enabled by setting the LVDEN bit Moreover, if LP oscillator was active during Sleep and
(RCON<12>). LP is the oscillator used on wake-up, then the start-up
delay is equal to TPOR. PWRT delay and OST timer
delay are not applied. In order to have the smallest
possible start-up delay when waking up from Sleep,
one of these faster wake-up options should be selected
before entering Sleep.
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 1)
OSCCON 0742 — COSC<2:0> — NOSC<2:0> POST<1:0> LOCK — CF — LPOSCEN OSWEN (Note 2)
OSCTUN 0744 — — — — — — — — — — — — TUN3 TUN2 TUN1 TUN0 0000 0000 0000 0000
PMD1 0770 T5MD T4MD T3MD T2MD T1MD — — DCIMD I2CMD U2MD U1MD — SPI1MD — C1MD ADCMD 0000 0000 0000 0000
PMD2 0772 IC8MD IC7MD — — — — IC2MD IC1MD — — — — OC4MD OC3MD OC2MD OC1MD 0000 0000 0000 0000
Note 1: Reset state depends on type of Reset.
2: Reset state depends on Configuration bits.
3: For the dsPIC30F3014 device, the DCIMD, T4MD, T5MD, OC3MD, OC4,MD, IC7MD and IC8MD bits do not perform any function.
4: Refer to “dsPIC30F Family Reference Manual” (DS70046) for descriptions of register bit fields.
†NOTICE:
Stresses above those listed under “Absolute Maximum Ratings” may cause permanent damage to the
device. This is a stress rating only and functional operation of the device at those or any other conditions above those
indicated in the operation listings of this specification is not implied. Exposure to maximum rating conditions for
extended periods may affect device reliability.
Note: All peripheral electrical characteristics are specified. For exact peripherals available on specific
devices, please refer to the Family Cross Reference Table.
23.1 DC Characteristics
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.
I/O Pin
(Input)
DI35
DI40
VDD SY12
MCLR
Internal SY10
POR
SY11
PWRT
Time-out
SY30
OSC
Time-out
Internal
Reset
Watchdog
Timer
Reset
SY20
SY13
SY13
I/O Pins
SY35
FSCM
Delay
VBGAP
0V
TxCK
Tx10 Tx11
Tx15 Tx20
OS60
TMRX
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: 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
SDI MSb IN
(CSDI)
CS65 CS66
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 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 0710017
XXXXXXXXXX dsPIC
XXXXXXXXXX 30F4013
XXXXXXXXXX -301/PT e3
YYWWNNN 0710017
XXXXXXXXXX dsPIC
XXXXXXXXXX 30F4013
XXXXXXXXXX -30I/ML e3
YYWWNNN 0710017
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
Units INCHES
Dimension Limits MIN NOM MAX
Number of Pins N 40
Pitch e .100 BSC
Top to Seating Plane A – – .250
Molded Package Thickness A2 .125 – .195
Base to Seating Plane A1 .015 – –
Shoulder to Shoulder Width E .590 – .625
Molded Package Width E1 .485 – .580
Overall Length D 1.980 – 2.095
Tip to Seating Plane L .115 – .200
Lead Thickness c .008 – .015
Upper Lead Width b1 .030 – .070
Lower Lead Width b .014 – .023
Overall Row Spacing § eB – – .700
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. § Significant Characteristic.
3. Dimensions D and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed .010" per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
Microchip Technology Drawing C04-016B
44-Lead Plastic Thin Quad Flatpack (PT) – 10x10x1 mm Body, 2.00 mm Footprint [TQFP]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D
D1
E
e
E1
N
b
NOTE 1 1 2 3
NOTE 2
A α
c φ
β A1 A2
L L1
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Leads N 44
Lead Pitch e 0.80 BSC
Overall Height A – – 1.20
Molded Package Thickness A2 0.95 1.00 1.05
Standoff A1 0.05 – 0.15
Foot Length L 0.45 0.60 0.75
Footprint L1 1.00 REF
Foot Angle φ 0° 3.5° 7°
Overall Width E 12.00 BSC
Overall Length D 12.00 BSC
Molded Package Width E1 10.00 BSC
Molded Package Length D1 10.00 BSC
Lead Thickness c 0.09 – 0.20
Lead Width b 0.30 0.37 0.45
Mold Draft Angle Top α 11° 12° 13°
Mold Draft Angle Bottom β 11° 12° 13°
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Chamfers at corners are optional; size may vary.
3. Dimensions D1 and E1 do not include mold flash or protrusions. Mold flash or protrusions shall not exceed 0.25 mm per side.
4. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
Microchip Technology Drawing C04-076B
44-Lead Plastic Quad Flat, No Lead Package (ML) – 8x8 mm Body [QFN]
Note: For the most current package drawings, please see the Microchip Packaging Specification located at
http://www.microchip.com/packaging
D D2
EXPOSED
PAD
E2
b
2 2
1 1
N N K
NOTE 1 L
A3 A1
Units MILLIMETERS
Dimension Limits MIN NOM MAX
Number of Pins N 44
Pitch e 0.65 BSC
Overall Height A 0.80 0.90 1.00
Standoff A1 0.00 0.02 0.05
Contact Thickness A3 0.20 REF
Overall Width E 8.00 BSC
Exposed Pad Width E2 6.30 6.45 6.80
Overall Length D 8.00 BSC
Exposed Pad Length D2 6.30 6.45 6.80
Contact Width b 0.25 0.30 0.38
Contact Length L 0.30 0.40 0.50
Contact-to-Exposed Pad K 0.20 – –
Notes:
1. Pin 1 visual index feature may vary, but must be located within the hatched area.
2. Package is saw singulated.
3. Dimensioning and tolerancing per ASME Y14.5M.
BSC: Basic Dimension. Theoretically exact value shown without tolerances.
REF: Reference Dimension, usually without tolerance, for information purposes only.
W
Wake-up from Sleep ......................................................... 135
Wake-up from Sleep and Idle.............................................. 60
Watchdog Timer
Timing Characteristics .............................................. 179
Timing Requirements ................................................ 180
Watchdog Timer (WDT) ............................................ 135, 149
Enabling and Disabling ............................................. 149
Operation .................................................................. 149
WWW Address.................................................................. 215
WWW, On-Line Support........................................................ 7
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
12/08/06