English
Language : 

PIC16C717 Datasheet, PDF (45/200 Pages) Microchip Technology – 18/20-Pin, 8-Bit CMOS Microcontrollers with 10/12-Bit A/D
PIC16C717/770/771
4.0.3 READING THE EPROM PROGRAM
MEMORY
To read a program memory location, the user must
write 2 bytes of the address to the PMADRH and
PMADRL registers, then set control bit RD
(PMCON1<0>). Once the read control bit is set, the
Program Memory Read (PMR) controller will use the
second instruction cycle after 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 and
PMDATL registers; therefore it can be read as 2 bytes
in the following instructions. PMDATH and PMDATL
registers will hold this value until another read or until it
is written to by the user.
EXAMPLE 4-1: OTP PROGRAM MEMORY READ
BSF
STATUS, RP1
;
BCF
STATUS, RP0
; Bank 2
MOVLW MS_PROG_PM_ADDR ;
MOVWF PMADRH
; MS Byte of Program Memory Address to read
MOVLW LS_PROG_PM_ADDR ;
MOVWF PMADRL
; LS Byte of Program Memory Address to read
BSF
STATUS, RP0
; Bank 3
BSF
PMCON1, RD
; Program Memory Read
NOP
; This instruction is executed
NOP
; This instruction must be a NOP
next instruction
; PMDATH:PMDATL now has the data
4.0.4 OPERATION DURING CODE PROTECT
When the device is code protected, the CPU can still
perform the program memory read function.
FIGURE 4-1: PROGRAM MEMORY READ CYCLE EXECUTION
Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4
Program
Memory
ADDR
PC
PC+1
PMADRH,PMADRL
PC+3
INSTR(PC-1) BSF PMCON1,RD
Executed here
Executed here
INSTR(PC+1)
Executed here
Forced NOP
Executed here
PC+4
PC+5
INSTR(PC+3)
Executed here
INSTR(PC+4)
Executed here
RD bit
PMDATH
PMDATL
register
© 1999 Microchip Technology Inc.
Advanced Information
DS41120A-page 45