Professional Documents
Culture Documents
Dspic30F2010 Data Sheet: 28-Pin High-Performance Digital Signal Controllers
Dspic30F2010 Data Sheet: 28-Pin High-Performance Digital Signal Controllers
Data Sheet
28-pin High-Performance
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
SPITM
I2CTM
CAN
SRAM EEPROM Timer Input A/D 10-bit Quad
Device Pins Mem. Bytes/ Comp/Std Control
Bytes Bytes 16-bit Cap 500 Ksps Enc
Instructions PWM PWM
* This table provides a summary of the dsPIC30F2010 peripheral features. Other available devices in the dsPIC30F
Motor Control and Power Conversion Family are shown for feature comparison.
MCLR 1 28 AVDD
EMUD3/AN0/VREF+/CN2/RB0 2 27 AVSS
EMUC3/AN1/VREF-/CN3/RB1 3 26 PWM1L/RE0
AN2/SS1/CN4/RB2 4 25 PWM1H/RE1
dsPIC30F2010
AN3/INDX/CN5/RB3 5 24 PWM2L/RE2
AN4/QEA/IC7/CN6/RB4 6 23 PWM2H/RE3
AN5/QEB/IC8/CN7/RB5 7 22 PWM3L/RE4
VSS 8 21 PWM3H/RE5
OSC1/CLKI 9 20 VDD
OSC2/CLKO/RC15 10 19 VSS
EMUD1/SOSCI/T2CK/U1ATX/CN1//RC13 11 18 PGC/EMUC/U1RX/SDI1/SDA/RF2
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14 12 17 PGD/EMUD/U1TX/SDO1/SCL/RF3
VDD 13 16 FLTA/INT0/SCK1/OCFA/RE8
EMUD2/OC2/IC2/INT2/RD1 14 15 EMUC2/OC1/IC1/INT1/RD0
28-Pin QFN
EMUC3/AN1/VREF- /CN3/RB1
EMUD3/AN0/VREF+/CN2/RB0
PWM1H/RE1
PWM1L/RE0
MCLR
AVDD
AVSS
22
28
27
26
25
24
23
AN2/SS1/CN4/RB2 1 21 PWM2L/RE2
AN3/INDX/CN5 RB3 2 20 PWM2H/RE3
AN4/QEA/IC7/CN6/RB4 3 19 PWM3L/RE4
AN5/QEB/IC8/CN7/RB5 4 dsPIC30F2010 18 PWM3H/RE5
VSS 5 17 VDD
OSC1/CLKIN 6 16 VSS
OSC2/CLKO/RC15 7 15 PGC/EMUC/U1RX/SDI1/SDA/RF2
10
12
13
14
11
8
9
EMUD1/SOSCI/T2CK/U1ATX/CN1/RC13
EMUC1/SOSCO/T1CK/U1ARX/CN0/RC14
VDD
EMUD2/OC2/IC2/INT2/RD1
EMUC2/OC1/IC1/INT1/RD0
PGD/EMUD/U1TX/SDO1/SCL/RF3
FLTA/INT0/SCK1/OCFA/RE8
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)
• The Microchip Corporate Literature Center; U.S. FAX: (480) 792-7277
When contacting a sales office or the literature center, please specify which device, revision of silicon and data sheet (include
literature number) you are using.
Y Data Bus
X Data Bus
16 16 16 16
16
Interrupt Data Latch Data Latch
Controller PSV & Table Y Data
Data Access X Data
24 Control Block 8 16 RAM RAM
(256 bytes) (256 bytes)
Address Address
24 Latch Latch
16 16 16
24 X RAGU
Y AGU
PCU PCH PCL X WAGU AN0/CN2/RB0
Program Counter AN1/CN3/RB1
Address Latch Stack Loop AN2/SS1/LVDIN/CN4/RB2
Control Control
Logic Logic AN3/INDX/CN5/RB3
Program Memory
(12 Kbytes) AN4/QEA/CN6/RB4
AN5/QEB/CN7/RB5
Data EEPROM
(1 Kbyte) Effective Address PORTB
Data Latch 16
ROM Latch 16
24
IR
EMUD1/SOSCI/CN1/RC13
16 16 EMUC1/SOSCO/T1CK/CN0/RC14
OSC2/CLKO/RC15
16 x 16
W Reg Array PORTC
Decode
Instruction
Decode & 16 16
Control
Input Output
10-bit ADC Capture Compare I2C
PWM1L/RE0
Module Module
PWM1H/RE1
PWM2L/RE2
PWM2H/RE3
PWM3L/RE4
PWM3H/RE5
Motor Control FLTA/INT1/RE8
SPI1 Timers QEI UART1
PWM
PORTE
U1RX/RF2
U1TX/RF3
PORTF
D15 D0
W0/WREG
PUSH.S Shadow
W1
DO Shadow
W2
W3 Legend
W4
DSP Operand W5
Registers
W6
W7
Working Registers
W8
W9
DSP Address
Registers W10
W11
W12/DSP Offset
W13/DSP Write Back
W14/Frame Pointer
W15/Stack Pointer
PC22 PC0
0 Program Counter
7 0
TABPAG
TBLPAG Data Table Page Address
7 0
PSVPAG Program Space Visibility Page Address
15 0
RCOUNT REPEAT Loop Counter
15 0
DCOUNT DO Loop Counter
22 0
DOSTART DO Loop Start Address
22
DOEND DO Loop End Address
15 0
CORCON Core Configuration Register
SRH SRL
S
a
40 40-bit Accumulator A 40 Round t 16
40-bit Accumulator B u
Logic r
a
Carry/Borrow Out t
Saturate e
Carry/Borrow In Adder
Negate
40
40 40
Barrel
16
Shifter
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
User Memory
0000FE
space, as defined by Table 3-1. Note that the program
Space
000100
space address is incremented by two between succes- User Flash
sive program words, in order to provide compatibility Program Memory
(4K instructions)
with data space addressing.
001FFE
User program space access is restricted to the lower 002000
Reserved
4M instruction word address range (0x000000 to (Read 0’s)
0x7FFFFE), for all accesses other than TBLRD/TBLWT, 7FFBFE
which use TBLPAG<7> to determine user or configura- 7FFC00
Data EEPROM
tion space access. In Table 3-1, Read/Write instruc- (1 Kbyte)
7FFFFE
tions, bit 23 allows access to the Device ID, the User ID
and the configuration bits. Otherwise, bit 23 is always 800000
clear.
Note: The address map shown in Figure 3-1 is
conceptual, and the actual memory con-
figuration may vary across individual
devices depending on available memory.
Reserved
Configuration Memory
8005BE
Space
8005C0
UNITID (32 instr.)
8005FE
800600
Reserved
F7FFFE
Device Configuration F80000
Registers F8000E
F80010
Reserved
FEFFFE
DEVID (2) FF0000
FFFFFE
23 bits
Using
Program 0 Program Counter 0
Counter
Select
1 EA
Using
Program 0 PSVPAG Reg
Space
Visibility 8 bits 15 bits
EA
User/ Byte
Configuration 24-bit EA
Space Select
Select
Note: Program Space Visibility cannot be used to access bits <23:16> of a word in program memory.
PC Address 23 16 8 0
0x000000 00000000
0x000002 00000000
0x000004 00000000
0x000006 00000000
TBLRDL.B (Wn<0> = 0)
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 pro-
MEMORY USING PROGRAM SPACE gram memory word, the LS 15 bits of data 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-5.
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 MS bit 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 will require one instruc-
Core Control register (CORCON). The functions of tion cycle in addition to the specified execution
CORCON are discussed in Section 2.4, DSP Engine. time:
Data accesses to this area add an additional cycle to - MAC class of instructions with data operand
the instruction being executed, since two program pre-fetch
memory fetches are required. - MOV instructions
Note that the upper half of addressable data space is - MOV.D instructions
always part of the X data space. Therefore, when a • All other instructions will require two instruction
DSP operation uses program space mapping to access cycles in addition to the specified execution time
this memory region, Y data space should typically con- of the instruction.
tain state (variable) data for DSP operations, whereas
X data space should typically contain coefficient For instructions that use PSV which are executed
(constant) data. inside a REPEAT loop:
Although each data space address, 0x8000 and higher, • The following instances will require two instruction
maps directly into a corresponding program memory cycles in addition to the specified execution time
address (see Figure 3-5), only the lower 16-bits of the of the instruction:
24-bit program word are used to contain the data. The - Execution in the first iteration
upper 8 bits should be programmed to force an illegal - Execution in the last iteration
instruction to maintain machine robustness. Refer to - Execution prior to exiting the loop due to an
the Programmer’s Reference Manual (DS70030) for interrupt
details on instruction encoding.
- Execution upon re-entering the loop after an
interrupt is serviced
• Any other iteration of the REPEAT loop will allow
the instruction, accessing data using PSV, to
execute in a single cycle.
15 PSVPAG(1)
EA<15> = 0 0x00
8
Data 16
Space 0x8000
EA 15 23 15 0
Address
EA<15> = 1 0x001200
15 Concatenation 23
Note: PSVPAG is an 8-bit register, containing bits <22:15> of the program space address
(i.e., it defines the page in program space to which the upper half of data space is being mapped).
3.2 Data Address Space When executing any instruction other than one of the
MAC class of instructions, the X block consists of the
The core has two data spaces. The data spaces can be 256 byte data address space (including all Y
considered either separate (for some DSP instruc- addresses). When executing one of the MAC class of
tions), or as one unified linear address range (for MCU instructions, the X block consists of the 256 bytes data
instructions). The data spaces are accessed using two address space excluding the Y address block (for data
Address Generation Units (AGUs) and separate data reads only). In other words, all other instructions regard
paths. the entire data memory as one composite address
space. The MAC class instructions extract the Y
3.2.1 DATA SPACE MEMORY MAP address space from data space and address it using
The data space memory is split into two blocks, X and EAs sourced from W10 and W11. The remaining X data
Y data space. A key element of this architecture is that space is addressed using W8 and W9. Both address
Y space is a subset of X space, and is fully contained spaces are concurrently accessed only with the MAC
within X space. In order to provide an apparent linear class instructions.
addressing space, X and Y spaces have contiguous A data space memory map is shown in Figure 3-6.
addresses.
MS Byte LS Byte
Address 16 bits Address
MSB LSB
0x0001 0x0000
SFR Space SFR Space
(Note)
0x07FF 0x07FE
0x0801 0x0800
2560 bytes
Near
X Data RAM (X)
256 bytes Data
Space
512 bytes 0x08FF 0x08FE
SRAM Space 0x0901 0x0900
0x09FF 0x0A00
(Note)
0x8001 0x8000
X Data
Unimplemented (X)
Optionally
Mapped
into Program
Memory
0xFFFF 0xFFFE
X SPACE
UNUSED
X SPACE
X SPACE
UNUSED
Indirect EA using any W Indirect EA using W8, W9 Indirect EA using W10, W11
DS70118E-page 28
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
dsPIC30F2010
Preliminary
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
DOSTARTH 003C — — — — — — — — — DOSTARTH 0000 0000 0uuu uuuu
DOENDL 003E DOENDL 0 uuuu uuuu uuuu uuu0
DOENDH 0040 — — — — — — — — — DOENDH 0000 0000 0uuu uuuu
SR 0042 OA OB SA SB OAB SAB DA DC IPL2 IPL1 IPL0 RA N OV Z C 0000 0000 0000 0000
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
Legend: u = uninitialized bit
Preliminary
dsPIC30F2010
DS70118E-page 29
dsPIC30F2010
NOTES:
File Register Direct The address of the file register is specified explicitly.
Register Direct The contents of a register are accessed directly.
Register Indirect The contents of Wn forms the EA.
Register Indirect Post-modified The contents of Wn forms the EA. Wn is post-modified (incremented or
decremented) by a constant value.
Register Indirect Pre-modified Wn is pre-modified (incremented or decremented) by a signed constant value
to form the EA.
Register Indirect with Register Offset The sum of Wn and Wb forms the EA.
Register Indirect with Literal Offset The sum of Wn and a literal forms the EA.
Byte
Address MOV #0x1100,W0
MOV W0, XMODSRT ;set modulo start address
MOV #0x1163,W0
MOV W0,MODEND ;set modulo end address
0x1100 MOV #0x8001,W0
MOV W0,MODCON ;enable W1, X AGU for modulo
MOV #0x0000,W0 ;W0 holds buffer fill value
MOV #0x1110,W1 ;point W1 to buffer
DO AGAIN,#0x31 ;fill the 50 buffer locations
MOV W0, [W1++] ;fill the next location
AGAIN: INC W0,W0 ;increment the fill value
0x1163
Pivot Point
XB = 0x0008 for a 16-word Bit-Reversed Buffer
DS70118E-page 42
IFS1 0086 — — — — — — — — INT2IF — — — — IC8IF IC7IF INT1IF 0000 0000 0000 0000
IFS2 0088 — — — — FLTAIF — — QEIIF PWMIF — — — — — — — 0000 0000 0000 0000
IEC0 008C CNIE MI2CIE SI2CIE NVMIE ADIE U1TXIE U1RXIE SPI1IE T3IE T2IE OC2IE IC2IE T1IE OC1IE IC1IE INT0IE 0000 0000 0000 0000
IEC1 008E — — — — — — — — INT2IE — — — — IC8IE IC7IE INT1IE 0000 0000 0000 0000
IEC2 0090 — — — — FLTAIE — — QEIIE PWMIE — — — — — — — 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
dsPIC30F2010
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 — — — — — IC8IP<2:0> — IC7IP<2:0> — INT1IP<2:0> 0100 0100 0100 0100
IPC5 009E — INT2IP<2:0> — — — — — — — — — — — — 0100 0000 0000 0000
IPC6 00A0 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC7 00A2 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC8 00A4 — — — — — — — — — — — — — — — — 0000 0000 0000 0000
IPC9 00A6 — PWMIP<2:0> — — — — — — — — — — — — 0000 0000 0000 0000
IPC10 00A8 — FLTAIP<2:0> — — — — — — — — — QEIIP<2:0> 0100 0000 0000 0100
IPC11 00AA — — — — — — — — — — — — — — — — 0000 0000 0000 0000
Preliminary
Legend: u = uninitialized bit
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
The dsPIC30F family of devices contains internal 6.3 Table Instruction Operation Summary
program Flash memory for executing user code. There
are two methods by which the user can program this The TBLRDL and the TBLWTL instructions are used to
memory: read or write to bits <15:0> of program memory.
TBLRDL and TBLWTL can access program memory in
1. In-Circuit Serial Programming (ICSP)
Word or Byte mode.
2. Run Time Self-Programming (RTSP)
The TBLRDH and TBLWTH instructions are used to read
or write to bits<23:16> of program memory. TBLRDH
6.1 In-Circuit Serial Programming
and TBLWTH can access program memory in Word or
(ICSP) Byte mode.
dsPIC30F devices can be serially programmed while in A 24-bit program memory address is formed using
the end application circuit. This is simply done with two bits<7:0> of the TBLPAG register and the effective
lines for Programming Clock and Programming Data address (EA) from a W register specified in the table
(which are named PGC and PGD respectively), and instruction, as shown in Figure 6-1.
three other lines for Power (VDD), Ground (VSS) and
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 6-2, the contents of the upper byte of W3 has no effect.
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
DS70118E-page 47
dsPIC30F2010
NOTES:
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
Preliminary
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
.
CNEN1 00C0 CN15IE CN14IE CN13IE CN12IE CN11IE CN10IE CN9IE CN8IE CN7IE CN6IE CN5IE CN4IE CN3IE CN2IE CN1IE CN0IE 0000 0000 0000 0000
CNEN2 00C2 — — — — — — — — — — CN21IE CN20IE CN19IE CN18IE CN17IE CN16IE 0000 0000 0000 0000
CNPU1 00C4 CN15PUE CN14PUE CN13PUE CN12PUE CN11PUE CN10PUE CN9PUE CN8PUE CN7PUE CN6PUE CN5PUE CN4PUE CN3PUE CN2PUE CN1PUE CN0PUE 0000 0000 0000 0000
CNPU2 00C6 — — — — — — — — — — CN21PUE CN20PUE CN19PUE CN18PUE CN17PUE CN16PUE 0000 0000 0000 0000
Legend: u = uninitialized bit
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
dsPIC30F2010
DS70118E-page 55
dsPIC30F2010
NOTES:
PR1
Equal
Comparator x 16 TSYNC
1 Sync
(3)
TMR1
Reset
0
0
T1IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
SOSCO/ TON 2
1X
T1CK
SOSCI
TCY 00
C1
SOSCI
C1 = C2 = 18 pF; R = 100K
DS70118E-page 60
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
dsPIC30F2010
Preliminary
2004 Microchip Technology Inc.
dsPIC30F2010
10.0 TIMER2/3 MODULE For 32-bit timer/counter operation, Timer2 is the LS
Word and Timer3 is the MS Word of the 32-bit timer.
Note: This data sheet summarizes features of this group
of dsPIC30F devices and is not intended to be a complete Note: For 32-bit timer operation, T3CON control
reference source. For more information on the CPU, bits are ignored. Only T2CON control bits
peripherals, register descriptions and general device are used for setup and control. Timer 2
functionality, refer to the dsPIC30F Family Reference clock and gate inputs are utilized for the
Manual (DS70046).
32-bit timer module, but an interrupt is
This section describes the 32-bit General Purpose generated with the Timer3 interrupt flag
(GP) Timer module (Timer2/3) and associated opera- (T3IF) and the interrupt is enabled with the
tional modes. Figure 10-1 depicts the simplified block Timer3 interrupt enable bit (T3IE).
diagram of the 32-bit Timer2/3 module. Figure 10-2 16-bit Mode: In the 16-bit mode, Timer2 and Timer3
and Figure 10-3 show Timer2/3 configured as two can be configured as two independent 16-bit timers.
independent 16-bit timers; Timer2 and Timer3, Each timer can be set up in either 16-bit Timer mode or
respectively. 16-bit Synchronous Counter mode. See Section 9.0,
Note: Timer2 is a ‘Type B’ timer and Timer3 is a Timer1 Module, for details on these two operating
‘Type C’ timer. Please refer to the appro- modes.
priate timer type in Section 22.0 Electrical The only functional difference between Timer2 and
Characteristics of this document. Timer3 is that Timer2 provides synchronization of the
The Timer2/3 module is a 32-bit timer, which can be clock prescaler output. This is useful for high frequency
configured as two 16-bit timers, with selectable operat- external clock inputs.
ing modes. These timers are utilized by other 32-bit Timer Mode: In the 32-bit Timer mode, the timer
peripheral modules such as: increments on every instruction cycle up to a match
• Input Capture value, preloaded into the combined 32-bit period regis-
• Output Compare/Simple PWM ter PR3/PR2, then resets to 0 and continues to count.
The following sections provide a detailed description, For synchronous 32-bit reads of the Timer2/Timer3
including setup and control registers, along with asso- pair, reading the LS word (TMR2 register) will cause
ciated block diagrams for the operational modes of the the MS word to be read and latched into a 16-bit
timers. holding register, termed TMR3HLD.
The 32-bit timer has the following modes: For synchronous 32-bit writes, the holding register
(TMR3HLD) must first be written to. When followed by
• Two independent 16-bit timers (Timer2 and a write to the TMR2 register, the contents of TMR3HLD
Timer3) with all 16-bit operating modes (except will be transferred and latched into the MSB of the
Asynchronous Counter mode) 32-bit timer (TMR3).
• Single 32-bit Timer operation
32-bit Synchronous Counter Mode: In the 32-bit
• Single 32-bit Synchronous Counter Synchronous Counter mode, the timer increments on
Further, the following operational characteristics are the rising edge of the applied external clock signal,
supported: which is synchronized with the internal phase clocks.
The timer counts up to a match value preloaded in the
• ADC Event Trigger
combined 32-bit period register PR3/PR2, then resets
• Timer Gate Operation to ‘0’ and continues.
• Selectable Prescaler Settings
When the timer is configured for the Synchronous
• Timer Operation during Idle and Sleep modes Counter mode of operation and the CPU goes into the
• Interrupt on a 32-bit Period Register Match Idle mode, the timer will stop incrementing, unless the
These operating modes are determined by setting the TSIDL (T2CON<13>) bit = 0. If TSIDL = 1, the timer
appropriate bit(s) in the 16-bit T2CON and T3CON module logic will resume the incrementing sequence
SFRs. upon termination of the CPU Idle mode.
TMR3HLD
16
16
Write TMR2
Read TMR2
16
Reset
TMR3 TMR2 Sync
MSB LSB
ADC Event Trigger
Comparator x 32
Equal
PR3 PR2
0
T3IF
Event Flag 1 Q D TGATE(T2CON<6>)
Q CK
TGATE
(T2CON<6>)
TGATE
TCS
TCKPS<1:0>
TON 2
T2CK 1X
Prescaler
Gate 1, 8, 64, 256
Sync 01
TCY
00
Note: Timer configuration bit T32, T2CON(<3>) must be set to 1 for a 32-bit timer/counter operation. All control
bits are respective to the T2CON register.
PR2
Equal
Comparator x 16
TMR2 Sync
Reset
0
T2IF
Event Flag 1 Q D TGATE
Q CK
TGATE
TGATE
TCS
TCKPS<1:0>
TON 2
T2CK 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
Sync 1X
Prescaler
See 01 1, 8, 64, 256
NOTE
TCY 00
Note: The dsPIC30F2010 does not have an external pin input to TIMER3. The following modes should not be used:
1. TCS = 1
2. TCS = 0 and TGATE = 1 (gated time accumulation)
Preliminary
dsPIC30F2010
DS70118E-page 65
dsPIC30F2010
NOTES:
• Frequency/Period/Pulse Measurements
• Additional sources of External Interrupts
The key operational features of the Input Capture
module are:
16 16
ICx ICTMR
Pin 1 0
Edge FIFO
Prescaler Clock Detection R/W
1, 4, 16 Synchronizer Logic Logic
3 ICM<2:0> ICxBUF
Mode Select
ICBNE, ICOV
ICI<1:0>
Interrupt
ICxCON Logic
Note: Where ‘x’ is shown, reference is made to the registers or bits associated to the respective input
capture channels 1 through N.
IC1CON 0142 — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
DS70118E-page 70
IC2CON 0146 — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC3CON 014A — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC4CON 014E — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC6CON 0156 — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC7CON 015A — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
IC8CON 015E — — ICSIDL — — — — — ICTMR ICI<1:0> ICOV ICBNE ICM<2:0> 0000 0000 0000 0000
Legend: u = uninitialized bit
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
Preliminary
2004 Microchip Technology Inc.
dsPIC30F2010
12.0 OUTPUT COMPARE MODULE The key operational features of the Output Compare
module include:
Note: This data sheet summarizes features of this group
of dsPIC30F devices and is not intended to be a complete
• Timer2 and Timer3 Selection mode
reference source. For more information on the CPU, • Simple Output Compare Match mode
peripherals, register descriptions and general device • Dual Output Compare Match mode
functionality, refer to the dsPIC30F Family Reference
Manual (DS70046). • Simple PWM mode
• Output Compare during Sleep and Idle modes
This section describes the Output Compare module
and associated operational modes. The features pro- • Interrupt on Output Compare/PWM Event
vided by this module are useful in applications requiring These operating modes are determined by setting
operational modes such as: the appropriate bits in the 16-bit OCxCON SFR (where
• Generation of Variable Width Output Pulses x = 1 and 2).
• Power Factor Correction OCxRS and OCxR in the figure represent the Dual
Compare registers. In the Dual Compare mode, the
Figure 12-1 depicts a block diagram of the Output
OCxR register is used for the first compare and OCxRS
Compare module.
is used for the second compare.
OCxRS
3 Output Enable
OCM<2:0>
Comparator Mode Select OCFA
(for x = 1 and 2)
OCTSEL
0 1 0 1
Note: Where ‘x’ is shown, reference is made to the registers associated with the respective output compare
channels 1and 2.
12.3 Dual Output Compare Match Mode The user must perform the following steps in order to
configure the output compare module for PWM
When control bits OCM<2:0> (OCxCON<2:0>) = 100 operation:
or 101, the selected output compare channel is config-
1. Set the PWM period by writing to the appropriate
ured for one of two Dual Output Compare modes,
period register.
which are:
2. Set the PWM duty cycle by writing to the OCxRS
• Single Output Pulse mode register.
• Continuous Output Pulse mode 3. Configure the output compare module for PWM
operation.
12.3.1 SINGLE PULSE MODE
4. Set the TMRx prescale value and enable the
For the user to configure the module for the generation Timer, TON (TxCON<15>) = 1.
of a single output pulse, the following steps are
required (assuming timer is off): 12.4.1 INPUT PIN FAULT PROTECTION
• Determine instruction cycle time TCY. FOR PWM
• Calculate desired pulse width value based on TCY. When control bits OCM<2:0> (OCxCON<2:0>) = 111,
• Calculate time to start pulse from timer start value the selected output compare channel is again config-
of 0x0000. ured for the PWM mode of operation, with the
• Write pulse width start and stop times into OCxR additional feature of input fault protection. While in this
and OCxRS compare registers (x denotes mode, if a logic 0 is detected on the OCFA/B pin, the
channel 1, 2). respective PWM output pin is placed in the high imped-
ance input state. The OCFLT bit (OCxCON<4>)
• Set timer period register to value equal to, or
indicates whether a Fault condition has occurred. This
greater than, value in OCxRS compare register.
state will be maintained until both of the following
• Set OCM<2:0> = 100. events have occurred:
• Enable timer, TON (TxCON<15>) = 1.
• The external Fault condition has been removed.
To initiate another single pulse, issue another write to • The PWM mode has been re-enabled by writing
set OCM<2:0> = 100. to the appropriate control bits.
Duty Cycle
12.7 Output Compare Interrupts For the PWM mode, when an event occurs, the respec-
tive timer interrupt flag (T2IF or T3IF) is asserted and
The output compare channels have the ability to gener- an interrupt will be generated, if enabled. The IF bit is
ate an interrupt on a compare match, for whichever located in the IFS0 Status register, and must be cleared
Match mode has been selected. in software. The interrupt is enabled via the respective
For all modes except the PWM mode, when a compare timer interrupt enable bit (T2IE or T3IE), located in the
event occurs, the respective interrupt flag (OCxIF) is IEC0 Control register. The output compare interrupt
asserted and an interrupt will be generated, if enabled. flag is never set during the PWM mode of operation.
The OCxIF bit is located in the corresponding IFS
Status register, and must be cleared in software. The
interrupt is enabled via the respective compare inter-
rupt enable (OCxIE) bit, located in the corresponding
IEC Control register.
DS70118E-page 74
OC2R 0188 Output Compare 2 Slave Register 0000 0000 0000 0000
OC2CON 018A — OCFRZ OCSIDL — — — — — — — — OCFLT2 OCTSEL2 OCM<2:0> 0000 0000 0000 0000
Legend: u = uninitialized bit
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
dsPIC30F2010
Preliminary
2004 Microchip Technology Inc.
dsPIC30F2010
13.0 QUADRATURE ENCODER The Quadrature Encoder Interface (QEI) is a key fea-
INTERFACE (QEI) MODULE ture requirement for several motor control applications,
such as Switched Reluctance (SR) and AC Induction
Note: This data sheet summarizes features of this group Motor (ACIM). The operational features of the QEI are,
of dsPIC30F devices and is not intended to be a complete but not limited to:
reference source. For more information on the CPU,
peripherals, register descriptions and general device • Three input channels for two phase signals and
functionality, refer to the dsPIC30F Family Reference index pulse
Manual (DS70046). • 16-bit up/down position counter
This section describes the Quadrature Encoder Inter- • Count direction status
face (QEI) module and associated operational modes. • Position Measurement (x2 and x4) mode
The QEI module provides the interface to incremental • Programmable digital noise filters on inputs
encoders for obtaining motor positioning data. Incre-
• Alternate 16-bit Timer/Counter mode
mental encoders are very useful in motor control
applications. • Quadrature Encoder Interface interrupts
These operating modes are determined by setting the
appropriate bits QEIM<2:0> (QEICON<10:8>).
Figure 13-1 depicts the Quadrature Encoder Interface
block diagram.
TQCKPS<1:0>
Sleep Input TQCS
2
TCY
0
Synchronize
Prescaler
Det 1 1, 8, 64, 256
1
QEIM<2:0>
0
QEIIF
D Q
TQGATE Event
CK Q Flag
Programmable
QEB
Digital Filter
Programmable
INDX
Digital Filter
Note: QEI pins are multiplexed with analog inputs. User must insure that all QEI associated pins are set as digital
inputs in the ADPCFG register.
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
DS70118E-page 79
dsPIC30F2010
NOTES:
PWMCON1
PWM Enable and Mode SFRs
PWMCON2
PWM Manual
OVDCON
Control SFR
PWM Generator #3
PDC3 Buffer
16-bit Data Bus
PDC3
Comparator
PWM Generator
Channel 1 Dead Time PWM1H
#1 Generator and
PTPER Override Logic PWM1L
FLTA
PTPER Buffer
PTCON
SEVTCMP PTDIR
PWMxH
PWMxL
The FLTA pin can be controlled manually in software. 14.14.1 SPECIAL EVENT TRIGGER
POSTSCALER
14.13 PWM Update Lockout
The PWM special event trigger has a postscaler that
For a complex PWM application, the user may need to allows a 1:1 to 1:16 postscale ratio. The postscaler is
write up to four duty cycle registers and the time base configured by writing the SEVOPS<3:0> control bits in
period register, PTPER, at a given time. In some appli- the PWMCON2 SFR.
cations, it is important that all buffer registers be written The special event output postscaler is cleared on the
before the new duty cycle and period values are loaded following events:
for use by the module.
• Any write to the SEVTCMP register
The PWM update lockout feature is enabled by setting
• Any device Reset
the UDIS control bit in the PWMCON2 SFR. The UDIS
bit affects all duty cycle buffer registers and the PWM
time base period buffer, PTPER. No duty cycle 14.15 PWM Operation During CPU Sleep
changes or period value changes will have effect while Mode
UDIS = 1.
The FLTA A and FLTA B input pins have the ability to
wake the CPU from Sleep mode. The PWM module
generates an interrupt if either of the FLTA pins is
driven low while in Sleep.
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
Preliminary
dsPIC30F2010
DS70118E-page 89
dsPIC30F2010
NOTES:
A series of eight (8) or sixteen (16) clock pulses shifts A basic difference between 8-bit and 16-bit operation is
out bits from the SPIxSR to SDOx pin and simulta- that the data is transmitted out of bit 7 of the SPIxSR for
neously shifts in data from SDIx pin. An interrupt is 8-bit operation, and data is transmitted out of bit 15 of
generated when the transfer is complete and the cor- the SPIxSR for 16-bit operation. In both modes, data is
responding interrupt flag bit (SPI1IF or SPI2IF) is set. shifted into bit 0 of the SPIxSR.
This interrupt can be disabled through an interrupt
enable bit (SPI1IE or SPI2IE). 15.1.2 SDOx DISABLE
The receive operation is double buffered. When a A control bit, DISSDO, is provided to the SPIxCON reg-
complete byte is received, it is transferred from ister to allow the SDOx output to be disabled. This will
SPIxSR to SPIxBUF. allow the SPI module to be connected in an input only
configuration. SDO can also be used for general
If the receive buffer is full when new data is being purpose I/O.
transferred from SPIxSR to SPIxBUF, the module will
set the SPIROV bit, indicating an overflow condition.
15.2 Framed SPI Support
The transfer of the data from SPIxSR to SPIxBUF will
not be completed and the new data will be lost. The The module supports a basic framed SPI protocol in
module will not respond to SCL transitions while Master or Slave mode. The control bit FRMEN enables
SPIROV is 1, effectively disabling the module until framed SPI support and causes the SSx pin to perform
SPIxBUF is read by user software. the frame synchronization pulse (FSYNC) function.
Transmit writes are also double buffered. The user The control bit SPIFSD determines whether the SSx
writes to SPIxBUF. When the master or slave transfer pin is an input or an output (i.e., whether the module
is completed, the contents of the shift register receives or generates the frame synchronization
(SPIxSR) is moved to the receive buffer. If any trans- pulse). The frame pulse is an active high pulse for a sin-
mit data has been written to the buffer register, the gle SPI clock cycle. When frame synchronization is
contents of the transmit buffer are moved to SPIxSR. enabled, the data transmission starts only on the
The received data is thus placed in SPIxBUF and the subsequent transmit edge of the SPI clock.
transmit data in SPIxSR is ready for the next transfer.
Note: Both the transmit buffer (SPIxTXB) and
the receive buffer (SPIxRXB) are mapped
to the same register address, SPIxBUF.
SPIxBUF SPIxBUF
Receive Transmit
SPIxSR
SDIx bit0
SDOx Shift
clock
SS & FSYNC Clock Edge
Control Select
SSx Control
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.
DS70118E-page 94
Legend: u = uninitialized bit
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
dsPIC30F2010
Preliminary
2004 Microchip Technology Inc.
dsPIC30F2010
16.0 I2C MODULE 16.1 Operating Function Description
Note: This data sheet summarizes features of this group The hardware fully implements all the master and slave
of dsPIC30F devices and is not intended to be a complete functions of the I2C Standard and Fast mode specifica-
reference source. For more information on the CPU, tions, as well as 7 and 10-bit addressing.
peripherals, register descriptions and general device
functionality, refer to the dsPIC30F Family Reference Thus, the I2C module can operate either as a slave or
Manual (DS70046). a master on an I2C bus.
The Inter-Integrated Circuit (I2C) module provides
16.1.1 VARIOUS I2C MODES
complete hardware support for both Slave and Multi-
Master modes of the I2C serial communication The following types of I2C operation are supported:
standard, with a 16-bit interface. • I2C Slave operation with 7-bit address
This module offers the following key features: • I2C Slave operation with 10-bit address
• I2C interface supporting both Master and Slave • I2C Master operation with 7 or 10-bit address
operation. See the I2C programmer’s model in Figure 16-1.
• I2C Slave mode supports 7 and 10-bit address.
• I2C Master mode supports 7 and 10-bit address. 16.1.2 PIN CONFIGURATION IN I2C MODE
• I2C port allows bi-directional transfers between I2C has a 2-pin interface; pin SCL is clock and pin SDA
master and slaves. is data.
• Serial clock synchronization for I2C port can be
used as a handshake mechanism to suspend and
resume serial transfer (SCLREL control).
• I2C supports Multi-Master operation; detects bus
collision and will arbitrate accordingly.
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
16.1.3 I2C REGISTERS The I2CADD register holds the slave address. A status
bit, ADD10, indicates 10-bit Address mode. The
I2CCON and I2CSTAT are control and status registers,
I2CBRG acts as the baud rate generator reload value.
respectively. The I2CCON register is readable and writ-
able. The lower 6 bits of I2CSTAT are read only. The In receive operations, I2CRSR and I2CRCV together
remaining bits of the I2CSTAT are read/write. form a double buffered receiver. When I2CRSR
receives a complete byte, it is transferred to I2CRCV
I2CRSR is the shift register used for shifting data,
and an interrupt pulse is generated. During
whereas I2CRCV is the buffer register to which data
transmission, the I2CTRN is not double buffered.
bytes are written, or from which data bytes are read.
I2CRCV is the receive buffer, as shown in Figure 16-1. Note: Following a Restart condition in 10-bit
I2CTRN is the transmit register to which bytes are writ- mode, the user only needs to match the
ten during a transmit operation, as shown in Figure 16-2. first 7-bit address.
Internal
Data Bus
I2CRCV
Read
Shift
SCL Clock
I2CRSR
LSB
SDA Addr_Match
Match Detect
Write
I2CADD
Read
Start and
Stop bit Detect
Write
I2CSTAT
Start, Restart,
Stop bit Generate
Read
Control Logic
Collision
Detect
Write
I2CCON
Acknowledge
Read
Generation
Clock
Stretching Write
I2CTRN
Shift LSB Read
Clock
Reload
Control Write
As a Master device, six operations are supported. 16.12.2 I2C MASTER RECEPTION
• Assert a Start condition on SDA and SCL. Master mode reception is enabled by programming the
• Assert a Restart condition on SDA and SCL. receive enable (RCEN) bit (I2CCON<11>). The I2C
• Write to the I2CTRN register initiating module must be Idle before the RCEN bit is set, other-
transmission of data/address. wise the RCEN bit will be disregarded. The baud rate
generator begins counting, and on each rollover, the
• Generate a Stop condition on SDA and SCL.
state of the SCL pin toggles, and data is shifted in to the
• Configure the I2C port to receive data. I2CRSR on the rising edge of each clock.
• Generate an ACK condition at the end of a
received byte of data.
Preliminary
dsPIC30F2010
DS70118E-page 101
dsPIC30F2010
NOTES:
Write Write
– Control TSR
– Control Buffer
– Generate Flags
– Generate Interrupt
Load TSR
UxTXIF
UTXBRK
Data
Transmit Shift Register (UxTSR)
‘0’ (Start)
UxTX
‘1’ (Stop)
Control
Signals
Note: x = 1 only.
UxMODE UxSTA
LPBACK 8-9
From UxTX
1 Load RSR
to Buffer Control
FERR
PERR
Receive Shift Register Signals
UxRX
0 (UxRSR)
Note: x = 1 only.
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
DS70118E-page 109
dsPIC30F2010
NOTES:
AVDD AVSS
VREF+
VREF-
AN0 AN0
AN3 +
S/H CH1 ADC
-
-
16-word, 10-bit
Dual Port
Buffer
Bus Interface
AN2 AN2
AN5 +
S/H CH3
- CH1,CH2,
CH3,CH0 Sample/Sequence
Sample Control
AN0
AN1 Input
AN2 Switches Input Mux
AN3 AN3 Control
AN4 AN4
AN5 AN5 +
S/H CH0
AN1 -
CHOLD
VA CPIN I leakage = DAC capacitance
VT = 0.6V ± 500 nA = 4.4 pF
VSS
Note: CPIN value depends on device package and is not tested. Effect of CPIN negligible if Rs ≤ 5 kΩ.
RAM Contents: d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Read to Bus:
Signed Fractional (1.15) d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0 0 0
Fractional (1.15) d09 d08 d07 d06 d05 d04 d03 d02 d01 d00 0 0 0 0 0 0
Signed Integer d09 d09 d09 d09 d09 d09 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Integer 0 0 0 0 0 0 d09 d08 d07 d06 d05 d04 d03 d02 d01 d00
Preliminary
ADPCFG 02A8 — — — — — — — — — — PCFG5 PCFG4 PCFG3 PCFG2 PCFG1 PCFG0 0000 0000 0000 0000
ADCSSL 02AA — — — — — — — — — — CSSL5 CSSL4 CSSL3 CSSL2 CSSL1 CSSL0 0000 0000 0000 0000
Legend: u = uninitialized bit
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
dsPIC30F2010
DS70118E-page 117
dsPIC30F2010
NOTES:
Wake-up Request
FPLL
OSC1
Primary PLL
Oscillator x4, x8, x16 PLL
OSC2
Lock COSC<1:0>
Primary Osc
NOSC<1:0>
Primary
Oscillator OSWEN
Stability Detector
Oscillator
POR Done Start-up
Clock
Timer
Switching
Programmable
Secondary Osc and Control Clock Divider System
Block
Clock
SOSCO
Secondary 2
32 kHz LP
Oscillator
SOSCI Oscillator
Stability Detector POST<1:0>
CF
Fail-Safe Clock
FCKSM<1:0> Monitor (FSCM)
2 Oscillator Trap
to Timer1
RESET
Instruction
Digital
Glitch Filter
MCLR
Sleep or Idle
WDT
Module
Illegal Opcode/
Uninitialized W Register
19.3.1 POR: POWER-ON RESET The POR circuit inserts a small delay, TPOR, which is
nominally 10 µs and ensures that the device bias cir-
A power-on event will generate an internal POR pulse
cuits are stable. Furthermore, a user selected power-
when a VDD rise is detected. The Reset pulse will occur
up time-out (TPWRT) is applied. The TPWRT parameter
at the POR circuit threshold voltage (VPOR), which is
is based on device configuration bits and can be 0 ms
nominally 1.85V. The device supply voltage character-
(no delay), 4 ms, 16 ms or 64 ms. The total delay is at
istics must meet specified starting voltage and rise rate
device power-up TPOR + TPWRT. When these delays
requirements. The POR pulse will reset a POR timer
have expired, SYSRST will be negated on the next
and place the device in the Reset state. The POR also
leading edge of the Q1 clock, and the PC will jump to
selects the device clock source identified by the oscil-
the Reset vector.
lator configuration fuses.
The timing for the SYSRST signal is shown in
Figure 19-3 through Figure 19-5.
VDD
MCLR
INTERNAL POR
TOST
OST TIME-OUT
TPWRT
PWRT TIME-OUT
INTERNAL Reset
FIGURE 19-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 19-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
19.3.1.2 Operating without FSCM and PWRT FIGURE 19-6: EXTERNAL POWER-ON
If the FSCM is disabled and the Power-up Timer RESET CIRCUIT (FOR
(PWRT) is also disabled, then the device will exit rap- SLOW VDD POWER-UP)
idly from Reset on power-up. If the clock source is VDD
FRC, LPRC, EXTRC or EC, it will be active
immediately. D R
If the FSCM is disabled and the system clock has not R1
MCLR
started, the device will be in a frozen state at the Reset
vector until the system clock starts. From the user’s C dsPIC30F
perspective, the device will appear to be in Reset until
a system clock is available.
Note 1: External Power-on Reset circuit is
19.3.2 BOR: PROGRAMMABLE required only if the VDD power-up slope
BROWN-OUT RESET is too slow. The diode D helps discharge
The BOR (Brown-out Reset) module is based on an the capacitor quickly when VDD powers
internal voltage reference circuit. The main purpose of down.
the BOR module is to generate a device Reset when a 2: R should be suitably chosen so as to
brown-out condition occurs. Brown-out conditions are make sure that the voltage drop across
generally caused by glitches on the AC mains (i.e., R does not violate the device’s electrical
missing portions of the AC cycle waveform due to bad specification.
power transmission lines or voltage sags due to exces-
3: R1 should be suitably chosen so as to
sive current draw when a large inductive load is turned
limit any current flowing into MCLR from
on).
external capacitor C, in the event of
The BOR module allows selection of one of the follow- MCLR/VPP pin breakdown due to Elec-
ing voltage trip points: trostatic Discharge (ESD) or Electrical
• 2.0V Overstress (EOS).
• 2.7V
• 4.2V Note: Dedicated supervisory devices, such as
the MCP1XX and MCP8XX, may also be
• 4.5V
used as an external Power-on Reset cir-
Note: The BOR voltage trip points indicated here cuit.
are nominal values provided for design
guidance only.
The Watchdog Timer can be “Enabled” or “Disabled” Note: If a POR or BOR occurred, the selection of
only through a configuration bit (FWDTEN) in the the oscillator is based on the FOS<1:0>
configuration register FWDT. and FPR<3:0> configuration bits.
Setting FWDTEN = 1 enables the Watchdog Timer. If the clock source is an oscillator, the clock to the
The enabling is done when programming the device. device will be held off until OST times out (indicating a
By default, after chip-erase, FWDTEN bit = 1. Any stable oscillator). If PLL is used, the system clock is
device programmer capable of programming held off until LOCK = 1 (indicating that the PLL is
dsPIC30F devices allows programming of this and stable). In either case, TPOR, TLOCK and TPWRT delays
other configuration bits. are applied.
If enabled, the WDT will increment until it overflows or If EC, FRC, LPRC or EXTRC oscillators are used, then
“times out”. A WDT time-out will force a device Reset a delay of TPOR (~ 10 µs) is applied. This is the smallest
(except during Sleep). To prevent a WDT time-out, the delay possible on wake-up from Sleep.
user must clear the Watchdog Timer using a CLRWDT Moreover, if LP oscillator was active during Sleep, and
instruction. LP is the oscillator used on wake-up, then the start-up
If a WDT times out during Sleep, the device will wake- delay will be equal to TPOR. PWRT delay and OST
up. The WDTO bit in the RCON register will be cleared timer delay are not applied. In order to have the small-
to indicate a wake-up resulting from a WDT time-out. est possible start-up delay when waking up from Sleep,
one of these faster wake-up options should be selected
Setting FWDTEN = 0 allows user software to enable/
before entering Sleep.
disable the Watchdog Timer via the SWDTEN
(RCON<5>) control bit. Any interrupt that is individually enabled (using the cor-
responding IE bit) and meets the prevailing priority
19.5 Power Saving Modes level will be able to wake-up the processor. The proces-
sor will process the interrupt and branch to the ISR.
There are two power saving states that can be entered The Sleep status bit in RCON register is set upon
through the execution of a special instruction, PWRSAV. wake-up.
These are: Sleep and Idle.
Note: In spite of various delays applied (TPOR,
The format of the PWRSAV instruction is as follows: TLOCK and TPWRT), the crystal oscillator
PWRSAV <parameter>, where ‘parameter’ defines (and PLL) may not be active at the end of
Idle or Sleep mode. the time-out (e.g., for low frequency crys-
tals. In such cases), if FSCM is enabled,
19.5.1 SLEEP MODE then the device will detect this as a clock
failure and process the Clock Failure Trap,
In Sleep mode, the clock to the CPU and peripherals is
the FRC oscillator will be enabled, and the
shutdown. If an on-chip oscillator is being used, it is
user will have to re-enable the crystal
shutdown.
oscillator. If FSCM is not enabled, then the
The fail-safe clock monitor is not functional during device will simply suspend execution of
Sleep, since there is no clock to monitor. However, code until the clock is stable, and will
LPRC clock remains active if WDT is operational during remain in Sleep until the oscillator clock
Sleep. has started.
The Brown-out protection circuit and the Low Voltage
Detect circuit, if enabled, will remain functional during
Sleep.
Note: Refer to dsPIC30F Family Reference Manual (DS70046) for descriptions of register bit fields.
Preliminary
dsPIC30F2010
DS70118E-page 131
dsPIC30F2010
NOTES:
The dsPIC30F instruction set adds many The literal instructions that involve data movement may
enhancements to the previous PICmicro® instruction use some of the following operands:
sets, while maintaining an easy migration from • A literal value to be loaded into a W register or file
PICmicro instruction sets. register (specified by the value of ‘k’)
Most instructions are a single program memory word • The W register or file register where the literal
(24-bits). Only three instructions require two program value is to be loaded (specified by ‘Wb’ or ‘f’)
memory locations. However, literal instructions that involve arithmetic or
Each single-word instruction is a 24-bit word divided logical operations use some of the following operands:
into an 8-bit opcode which specifies the instruction • The first source operand, which is a register ‘Wb’
type, and one or more operands which further specify without any address modifier
the operation of the instruction.
• The second source operand, which is a literal
The instruction set is highly orthogonal and is grouped value
into five basic categories: • The destination of the result (only if not the same
• Word or byte-oriented operations as the first source operand), which is typically a
• Bit-oriented operations register ‘Wd’ with or without an address modifier
• Literal operations The MAC class of DSP instructions may use some of the
• DSP operations following operands:
• Control operations • The accumulator (A or B) to be used (required
operand)
Table 20-1 shows the general symbols used in
describing the instructions. • The W registers to be used as the two operands
• The X and Y address space pre-fetch operations
The dsPIC30F instruction set summary in Table 20-2
lists all the instructions along with the status flags • The X and Y address space pre-fetch destinations
affected by each instruction. • The accumulator write back destination
Most word or byte-oriented W register instructions The other DSP instructions do not involve any
(including barrel shift instructions) have three multiplication, and may include:
operands: • The accumulator to be used (required)
• The first source operand, which is typically a • The source or destination operand (designated as
register ‘Wb’ without any address modifier Wso or Wdo, respectively) with or without an
• The second source operand, which is typically a address modifier
register ‘Ws’ with or without an address modifier • The amount of shift, specified by a W register ‘Wn’
• The destination of the result, which is typically a or a literal value
register ‘Wd’ with or without an address modifier The control instructions may use some of the following
However, word or byte-oriented file register instructions operands:
have two operands: • A program memory address
• The file register specified by the value ‘f’ • The mode of the Table Read and Table Write
• The destination, which could either be the file instructions
register ‘f’ or the W0 register, which is denoted as All instructions are a single word, except for certain
‘WREG’ double-word instructions, which were made double-
word instructions so that all the required information is
available in these 48-bits. In the second word, the
8 MSb’s are 0’s. If this second word is executed as an
instruction (by itself), it will execute as a NOP.
†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.
22.1 DC Characteristics
VDD
Load Condition 1 - for all pins except OSC2 Load Condition 2 - for OSC2
VDD/2
RL Pin CL
VSS
CL
Pin RL = 464 Ω
CL = 50 pF for all pins except OSC2
VSS 5 pF for OSC2 output
Q4 Q1 Q2 Q3 Q4 Q1
OSC1
OS20
OS30 OS30 OS31 OS31
OS25
CLKOUT
OS40 OS41
Param
Characteristic Min Typ Max Units Conditions
No.
Internal FRC Accuracy @ FRC Freq = 7.5 MHz(1)
FRC TBD % +25°C VDD = 3.0-3.6V
TBD % +25°C VDD = 4.5-5.5V
TBD % -40°C ≤ TA ≤ +85°C VDD = 3.0-3.6V
TBD % -40°C ≤ TA ≤ +85°C VDD = 4.5-5.5V
TBD % -40°C ≤ TA ≤ +125°C VDD = 4.5-5.5V
Note 1: Frequency calibrated at 25°C and 5V. TUN bits can be used to compensate for temperature drift.
Param
Characteristic Min Typ Max Units Conditions
No.
Internal FRC Jitter @ FRC Freq = 7.5 MHz(1)
FRC TBD % +25°C VDD = 3.0-3.6V
TBD % +25°C VDD = 4.5-5.5V
TBD % -40°C ≤ TA ≤ +85°C VDD = 3.0-3.6V
TBD % -40°C ≤ TA ≤ +85°C VDD = 4.5-5.5V
TBD % -40°C ≤ TA ≤ +125°C VDD = 4.5-5.5V
Note 1: Frequency calibrated at 25°C and 5V. TUN bits can be used to compensate for temperature drift.
I/O Pin
(Input)
DI35
DI40
VDD SY12
MCLR
Internal SY10
POR
SY11
PWRT
Time-out
SY30
OSC
Time-out
Internal
Reset
Watchdog
Timer
Reset
SY20
SY13
SY13
I/O Pins
SY35
FSCM
Delay
VBGAP
0V
TxCK
Tx10 Tx11
Tx15 Tx20
OS60
TMRX
QEB
TQ10 TQ11
TQ15 TQ20
POSCNT
ICX
IC10 IC11
IC15
OCx
(Output Compare
or PWM Mode) OC11 OC10
OC20
OCFA/OCFB
OC15
OCx
MP30
FLTA/B
MP20
PWMx
MP11 MP10
PWMx
TQ36
QEA
(input)
TQ31 TQ30
TQ35
QEB
(input) TQ41 TQ40
TQ31 TQ30
TQ35
QEB
Internal
QEA
(input)
QEB
(input)
Ungated
Index TQ50
TQ51
Index Internal
TQ55
Position
SCKx
(CKP = 0)
SCKx
(CKP = 1)
SP31 SP30
SP40 SP41
SP36
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP35
SP20 SP21
SP40 SP30,SP31
SP41
SSX
SP50 SP52
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP72 SP73
SP35
SP30,SP31 SP51
SP41
SP40
SP50 SP52
SCKX
(CKP = 0)
SCKX
(CKP = 1)
SP35
SP72 SP73
SP52
SP30,SP31 SP51
SDIX
MSb IN BIT14 - - - -1 LSb IN
SP41
SP40
SCL
IM31 IM34
IM30 IM33
SDA
Start Stop
Condition Condition
SDA
Out
SCL
IS31 IS34
IS30 IS33
SDA
Start Stop
Condition Condition
SDA
Out
AD50
ADCLK
Instruction
Execution SET SAMP CLEAR SAMP
SAMP
ch0_dischrg
ch0_samp
ch1_dischrg
ch1_samp
eoc
AD61
AD60
DONE
ADIF
ADRES(0)
ADRES(1)
1 2 3 4 5 6 8 9 5 6 8 9
AD50
ADCLK
Instruction
Execution SET ADON
SAMP
ch0_dischrg
ch0_samp
ch1_dischrg
ch1_samp
eoc
TSAMP TSAMP
AD55 AD55 TCONV
DONE
ADIF
ADRES(0)
ADRES(1)
1 2 3 4 5 6 7 3 4 5 6 8 3 4
XXXXXXX dsPIC30F2010
XXXXXXX -30I/MM
YYWWNNN 040700U
XXXXXXXXXXXXXXXXXXXX dsPIC30F2010-30I/SO
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
YYWWNNN 0348017
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.
* Standard device marking consists of Microchip part number, year code, week code and traceability code.
For device marking beyond this, certain price adders apply. Please check with your Microchip Sales Office.
For QTP devices, any special marking adders are included in QTP price.
E E2
EXPOSED
METAL
PAD
D D2
2 b
1
OPTIONAL ALTERNATE L
INDEX INDEX
TOP VIEW AREA INDICATORS BOTTOM VIEW
A1
A
2
n 1 α
E A2
L
c
β A1 B1
eB B p
E
E1
p
B
2
n 1
h
α
45°
c
A A2
φ
β L A1
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 2 0 1 0 AT- 3 0 E / S O - E S
Custom ID (3 digits) or
Trademark Engineering Sample (ES)
Architecture
Package
Flash SP = SPDIP
SO = SOIC
S = Die (Waffle Pack)
Memory Size in Bytes W = Die (Wafers)
0 = ROMless
1 = 1K to 6K
2 = 7K to 12K
3 = 13K to 24K
4 = 25K to 48K Temperature
5 = 49K to 96K I = Industrial -40°C to +85°C
6 = 97K to 192K E = Extended High Temp -40°C to +125°C
7 = 193K to 384K
8 = 385K to 768K
Speed
9 = 769K and Up
20 = 20 MIPS
30 = 30 MIPS
Device ID T = Tape and Reel
Example:
dsPIC30F2010AT-30E/SO = 30 MIPS, Extended temp., SOIC package, Rev. A
10/20/04