dsPIC33x Series Microcontroller
dsPIC33x Series Microcontroller
HIGHLIGHTS
This section of the manual contains the following topics:
Note: This family reference manual section is meant to serve as a complement to device
data sheets. Depending on the device variant, this manual section may not apply to
all dsPIC33/PIC24 devices.
Please consult the note at the beginning of the “Memory Organization” and
“Flash Program Memory” chapters in the current device data sheet to check
whether this document supports the device you are using.
Device data sheets and family reference manual sections are available for
download from the Microchip Worldwide Website at: http://www.microchip.com.
Reserved
0xF9FFFE
0xFA0000
Write Latches
0xFA0002
0xFA0004
Reserved
0xFEFFFE
0xFF0000
DEVID 0xFF0002
0xFF0004
Reserved
0xFFFFFE
User Program
0x0XXXXX
0x0XXXXX
Unimplemented
(Read ‘0’s)
0x7FBFFE
Auxiliary Program 0x7FC000
Flash Memory 0x7FFFF8
Auxiliary Interrupt 0x7FFFFA
Vector
GOTO Instruction(2) 0x7FFFFC
Reset Address(2) 0x7FFFFE
0x800000
Reserved
0x800FF6
USERID 0x800FF8
0x800FFE
0x801000
Configuration Memory Space
Reserved
0xF7FFFE
Device Configuration 0xF80000
Registers 0xF80012
0xF80014
Reserved
0xF9FFFE
0xFA0000
Write Latch
0xFA00FE
0xFA0100
Reserved
0xFEFFFE
0xFF0000
DEVID (2 Words)
0xFF0002
Reserved
0xFFFFFE
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
Note 1: When DSRPAG = 0x000, attempts to read from the paged Data Space (DS) window will cause an address
error trap.
2: DSRPAG is reset to 0x001.
3: The Program Space (PS) can be read using DSRPAG values of 0x200 or greater.
24 Bits
0x000000
Instruction
23 User 24
Latch
+1(1) Space
23
Instruction
Program Counter 0
22 0
0x7FFFFE
Figure 4-1: High and Low Address Regions for Table Operations
7 0 15 0
TBLPAG EA
24-Bit EA
0xFD0000
TABLE PAGE TABLE PAGE
0xFD 0xFD
0xFE0000
PC Address 23 16 8 0
0x000100 00000000 TBLRDL.W
0x000102 00000000
0x000104 00000000 TBLRDL.B (Wn<0> = 1)
0x000106 00000000 TBLRDL.B (Wn<0> = 0)
‘Phantom’ Byte
(Read as ‘0’)
‘Phantom’ Byte
(Read as ‘0’) 23 16 8 0 PC Address
TBLRDH.W 00000000 0x000100
00000000 0x000102
TBLRDH.B (Wn<0> = 1) 00000000 0x000104
00000000 0x000106
TBLRDH.B (Wn<0> = 0)
int main(void)
{
/* Read Configuration Register addresses 0xF80000 and 0xF80002 */
Data1 = MemRead (0xF8, 0x0006);
Data2 = MemRead (0xF8, 0x0008);
Data3 = MemRead (0xF8, 0x000A);
while(1);
}
.section .text
.global _MemRead
;************************
; Function _MemRead:
;
; W0 = TBLPAG value
; W1 = Table Offset
; Return: Data in W1:W0
;************************
_MemRead:
MOV W0, TBLPAG
NOP
TBLRDL [W1], W0
TBLRDH [W1], W1
RETURN
int main(void)
{
TBLPAG = __builtin_tblpage (prog_data);
tableOffset = __builtin_tbloffset (prog_data);
while(1);
}
16-Bit
Data Space
Address
0x0000
SFR and When DSRPAG<9> = 1: 24-Bit
Non-Mappable Program
Data Space MSB LSW Space
0x8000 Access Access Address
Mappable (DSRPAG<8> = 1) (DSRPAG<8> = 0)
Data Space 0x000000
0xFFFF PSV PAGE PSV PAGE
0x300 0x200
0x008000
0x7E8000
PSV PAGE PSV PAGE
0x3FD 0x2FD
0x7F0000
PSV PAGE PSV PAGE
0x3FE 0x2FE
0x7F8000
PSV PAGE PSV PAGE
0x3FF 0x2FF
0x7FFFFE
EA<15> 0
Byte
1 EA x
Select
1 x DSRPAG<7:0>(2)
8 Bits 15 Bits
DSRPAG
EA<15> Operation and Target
<9> <8>
The remaining address bits are provided by the eight LSbs of the Data Space Read Page register
(DSRPAG<7:0>). The DSRPAG<7:0> bits are concatenated with the 15 LSbs of the W register
holding the Effective Address, and the MSb is forced to ‘0’, thereby forming a 24-bit program
memory address.
Note: PSV can only be used to access values in the program memory space. Table
instructions must be used to access values in the user configuration space.
The LSb of the W register value is used as a Byte Select bit, which allows instructions using PSV
to operate in Byte or Word mode.
The PSV address is split into lsw and MSB. When DSRPAG<9:8> = 10, the lsw 16 bits of the
24-bit PS word can be accessed using PSV. When DSRPAG<9:8> = 11, the MSB of the 24-bit
PS word can be accessed using PSV. The range of valid DSRPAG values for a lsw read starts
at DSRPAG = 0x200 and the range of valid DSRPAG values for a MSB read starts at
DSRPAG = 0x300.
Note: The auto_psv option must be used if the user application is using both PSV and
EDS accesses on a device with more than 28 Kbytes of RAM.
int main(void)
{
int temp;
temp = DSRPAG; // Save original PSV page value
DSRPAG = __builtin_psvpage (m1);
sum1 = vectordot ((int *) m1, x);
DSRPAG = __builtin_psvpage (m2);
sum2 = vectordot ((int *) m2, x);
DSRPAG = temp; // Restore original PSV page value
sum = vectordot ((int *) m, x);
while(1);
}
done:
BRA done
RETURN
DS70000613E-page 17
dsPIC33/PIC24 Program Memory
dsPIC33/PIC24 Family Reference Manual
10.0 RELATED APPLICATION NOTES
This section lists application notes that are related to this section of the manual. These
application notes may not be written specifically for the dsPIC33/PIC24 Product Families, but the
concepts are pertinent and could be used with modification and possible limitations. The current
application notes related to the dsPIC33/PIC24 Program Memory module are:
Note: For additional Application Notes and code examples for the dsPIC33/PIC24 families
of devices, visit the Microchip website (www.microchip.com).
• 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.