EasyManua.ls Logo

Cmsemicon SC8F577 Series - Page 96

Default Icon
181 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
V1.8
SC8F577x
96 / 181
www.mcu.com.cn
12.5 Read Program Memory
To read the program memory unit, the user must write the high and low bits of the address to the EEADR
and EEADRH registers respectively, set the EEPGD bit of EECON1register to 1, and then set the control bit
RD to 1. Once the read control bit is set, the program memory controller will use the second instructions period
to read data. This will cause the second instructions following the "SETB EECON1, RD" instructions to be
ignored. In the next clock period, the value of the corresponding address of the program memory will be
latched to EEDAT in the EEDATH register, the user can read these two registers in the subsequent instructions.
The EEDAT and EEDATH register will save this value until the next time the user reads or writes data to the
unit.
Note:
1) The two instructions after the program memory read operation must be NOP. This prevents the user
from executing double period instructions in the next instruction after the RD position is 1.
2) If the WR bit is 1 when EEPGD=1, it will reset to 0 immediately without performing any operation.
exampleread flash program memory
LD
A, EE_ADDL
; Put the address to be read into the EEADR register
LD
EEADR, A
LD
A, EE_ADDH
; Put the high bit of the address to be read into EEADRH
register
LD
EEADRH, A
SETB
EECON1, EEPGD
;select to operate on program memory
SETB
EECON1, RD
;enable read
NOP
NOP
LD
A, EEDAT
;save read data
LD
EE_DATL, A
LD
A, EEDATH
LD
EE_DATH, A
12.6 Write Program Memory
program memory is read only, cannot be written.

Related product manuals