English
Language : 

PIC24FJ16MC101_12 Datasheet, PDF (60/350 Pages) Microchip Technology – 16-bit Microcontrollers (up to 32 KB Flash and 2 KB SRAM)
PIC24FJ16MC101/102 AND PIC24FJ32MC101/102/104
5.2 RTSP Operation
The PIC24FJ16MC101/102 and PIC24FJ32MC101/
102/104 Flash program memory array is organized into
rows of 64 instructions or 192 bytes. RTSP allows the
user application to erase a page of memory, which con-
sists of eight rows (512 instructions); and to program
one word. Table 26-12 shows typical erase and pro-
gramming times. The 8-row erase pages are edge-
aligned from the beginning of program memory, on
boundaries of 1536 bytes.
5.3 Programming Operations
A complete programming sequence is necessary for
programming or erasing the internal Flash in RTSP
mode. The processor stalls (waits) until the operation is
finished.
The programming time depends on the FRC accuracy
(see Table 26-18) and the value of the FRC Oscillator
Tuning register (see Register 8-3). Use the following
formula to calculate the minimum and maximum values
for the Word Write Time and Page Erase Time (see
Table 26-12).
EQUATION 5-1: PROGRAMMING TIME
7----.-3---7-----M-----H----z----×-----(--F----R----C-----A----c--c---u---r--Ta---c---y---)---%------×-----(--F----R----C-----T----u---n--i--n---g----)--%---
For example, if the device is operating at +125°C, the
FRC accuracy will be ±2%. If the TUN<5:0> bits (see
Register 8-3) are set to ‘b000000, the minimum row
write time is equal to Equation 5-2.
EQUATION 5-2: MINIMUM ROW WRITE
TIME
TRW = 7---.--3---7-----M-----H----z----×-----(--1-3---5-+--5---0--C-.-0--y-2--c--)-l-e-×--s---(--1-----–----0---.--0---0---3---7---5----)= 47.4μs
The maximum row write time is equal to Equation 5-3.
EQUATION 5-3: MAXIMUM ROW WRITE
TIME
TRW = 7----.-3---7-----M-----H----z----×-----(--1-3---5-–--5--0---C.--0--y-2--c-)-l--e-×--s--(---1----–-----0---.-0---0---3---7---5----) = 49.3μs
Setting the WR bit (NVMCON<15>) starts the opera-
tion, and the WR bit is automatically cleared when the
operation is finished.
5.3.1
PROGRAMMING ALGORITHM FOR
FLASH PROGRAM MEMORY
Programmers can program one word (24 bits) of
program Flash memory at a time. To do this, it is
necessary to erase the 8-row erase page that contains
the desired address of the location the user wants to
change.
For protection against accidental operations, the write
initiate sequence for NVMKEY must be used to allow
any erase or program operation to proceed. After the
programming command has been executed, the user
application must wait for the programming time until
programming is complete. The two instructions
following the start of the programming sequence
should be NOPs.
Note:
Performing a page erase operation on the
last page of program memory will clear the
Flash Configuration words, thereby
enabling code protection as a result.
Therefore, users should avoid performing
page erase operations on the last page of
program memory.
Refer to Section 4. “Program Memory” (DS39715) in
the “PIC24F Family Reference Manual” for details and
codes examples on programming using RTSP.
5.4 Control Registers
Two SFRs are used to read and write the program
Flash memory: NVMCON and NVMKEY.
The NVMCON register (Register 5-1) controls which
blocks are to be erased, which memory type is to be
programmed, and the start of the programming cycle.
NVMKEY is a write-only register that is used for write
protection. To start a programming or erase sequence,
the user application must consecutively write 0x55 and
0xAA to the NVMKEY register. Refer to Section 5.3
“Programming Operations” for further details.
DS39997C-page 60
Preliminary
© 2011-2012 Microchip Technology Inc.