Philips P89LPC901 Light Therapy Device User Manual


 
Philips Semiconductors
User’s Manual - Preliminary -
P89LPC901/902/903
FLASH PROGRAM MEMORY
2003 Dec 8 95
Figure 14-1: Flash Memory Control Register
Figure 14-2: Assembly language routine to erase/program all or part of a page
FMCON
Address: E4h
Not bit addressable
Reset Source(s): Any reset
Reset Value:
BIT SYMBOL FUNCTION
FMCON.7-4 - Reserved.
FMCON.3 HVA Set if either an interrupt or a brown-out is detected during a program or erase cycle. Also
set if the brown-out detector is disabled at the start of a program or erase cycle.
FMCON.2 HVE High voltage error. Set when an error occurs in the high voltage generator.
FMCON.1 SV Security violation. Set when an attempt is made to program, erase, or CRC a secured
sector or page.
FMCON.0 OI Operation interrupted. Set when cycle aborted due to an interrupt or reset.
76543210
- - - - HVA HVE SV OI
;* Inputs: *
;* R3 = number of bytes to program (byte) *
;* R4 = page address MSB(byte) *
;* R5 = page address LSB(byte) *
;* R7 = pointer to data buffer in RAM(byte) *
;* Outputs: *
;* R7 = status (byte) *
;* C = clear on no error, set on error *
LOAD EQU 00H
EP EQU 68H
PGM_USER:
MOV FMCON,#LOAD ;load command, clears page register
MOV FMADRH,R4 ;get high address
MOV FMADRL,R5 ;get low address
MOV A,R7 ;
MOV R0,A ;get pointer into R0
LOAD_PAGE:
MOV FMDAT,@R0 ;write data to page register
INC R0 ;point to next byte
DJNZ R3,LOAD_PAGE ;do until count is zero
MOV FMCON,#EP ;else erase & program the page
MOV R7,FMCON ;copy status for return
MOV A,R7 ;read status
ANL A,#0FH ;save only four lower bits
JNZ BAD ;
CLR C ;clear error flag if good
RET ;and return
BAD:
SETB C ;set error flag
RET ;and return