English
Language : 

PIC16F707 Datasheet, PDF (179/284 Pages) Microchip Technology – 40/44-Pin, Flash Microcontrollers with nanoWatt XLP and mTouch™ Technology
PIC16F707/PIC16LF707
20.0 PROGRAM MEMORY READ
The Flash program memory is readable during normal
operation over the full VDD range of the device. To read
data from Program Memory, five Special Function
Registers (SFRs) are used:
• PMCON1
• PMDATL
• PMDATH
• PMADRL
• PMADRH
The value written to the PMADRH:PMADRL register
pair determines which program memory location is
read. The read operation will be initiated by setting the
RD bit of the PMCON1 register. The program memory
flash controller takes two instructions to complete the
read. As a consequence, after the RD bit has been set,
the next two instructions will be ignored. To avoid
conflict with program execution, it is recommended that
the two instructions following the setting of the RD bit
are NOP. When the read completes, the result is placed
in the PMDATLH:PMDATL register pair. Refer to
Example 20-1 for sample code.
Note:
Code-protect does not effect the CPU
from performing a read operation on the
program memory. For more information,
refer to Section 8.2 “Code Protection”
EXAMPLE 20-1: PROGRAM MEMORY READ
BANKSEL
MOVF
MOVWF
MOVF
MOVWF
BANKSEL
BSF
NOP
NOP
BANKSEL
MOVF
MOVWF
MOVF
MOVWF
PMADRL
;
MS_PROG_ADDR, W ;
PMADRH
;MS Byte of Program Address to read
LS_PROG_ADDR, W ;
PMADRL
;LS Byte of Program Address to read
PMCON1
;
PMCON1, RD
;Initiate Read
PMDATL
PMDATL, W
LOWPMBYTE
PMDATH, W
HIGHPMBYTE
;Any instructions here are ignored as program
;memory is read in second cycle after BSF
;
;W = LS Byte of Program Memory Read
;
;W = MS Byte of Program Memory Read
;
 2010 Microchip Technology Inc.
Preliminary
DS41418A-page 179