![Microchip Technology PIC12F1501 Manual Download Page 90](http://html1.mh-extra.com/html/microchip-technology/pic12f1501/pic12f1501_manual_1785833090.webp)
2011-2015 Microchip Technology Inc.
DS40001609E-page 91
PIC16(L)F1508/9
10.2.1
READING THE FLASH PROGRAM
MEMORY
To read a program memory location, the user must:
1.
Write the desired address to the
PMADRH:PMADRL register pair.
2.
Clear the CFGS bit of the PMCON1 register.
3.
Then, set control bit RD of the PMCON1 register.
Once the read control bit is set, the program memory
Flash controller will use the second instruction cycle to
read the data. This causes the second instruction
immediately following the “
BSF PMCON1,RD
” instruction
to be ignored. The data is available in the very next cycle,
in the PMDATH:PMDATL register pair; therefore, it can
be read as two bytes in the following instructions.
PMDATH:PMDATL register pair will hold this value until
another read or until it is written to by the user.
FIGURE 10-1:
FLASH PROGRAM
MEMORY READ
FLOWCHART
Note:
The two instructions following a program
memory read are required to be
NOP
s.
This prevents the user from executing a
2-cycle instruction on the next instruction
after the RD bit is set.
Start
Read Operation
Select
Program or Configuration Memory
(CFGS)
Select
Word Address
(PMADRH:PMADRL)
Initiate Read operation
(RD =
1
)
Instruction fetched ignored
NOP
execution forced
Data read now in
PMDATH:PMDATL
Instruction fetched ignored
NOP
execution forced
End
Read Operation
Rev. 10-000046A
7/30/2013