Philips Semiconductors |
|
|
|
|
|
|
|
|
|
|
|
|
| User’s Manual - Preliminary - | |||||
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||
FLASH PROGRAM MEMORY |
|
|
|
| P89LPC906/907/908 | ||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FMCON |
|
| 7 |
| 6 |
| 5 |
| 4 |
| 3 |
| 2 | 1 |
| 0 |
|
| |
Address: E4h |
|
|
|
|
|
|
|
|
| ||||||||||
|
| - |
| - |
| - |
| - |
| HVA |
| HVE | SV |
| OI |
|
| ||
Not bit addressable |
|
|
|
|
|
|
|
|
| ||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
Reset Source(s): Any reset |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||
Reset Value: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BIT | SYMBOL | FUNCTION |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||
| - | Reserved. |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||
FMCON.3 |
| HVA | High voltage abort. Set if either an interrupt or a | ||||||||||||||||
|
|
| or erase cycle. Also set if | the | |||||||||||||||
|
|
| 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. |
|
|
| |||||||||||||
|
|
|
|
|
|
|
|
|
|
| |||||||||
|
|
|
| Figure |
|
|
|
|
|
| |||||||||
;* Inputs: |
|
|
|
| program (byte) | * |
|
|
|
|
|
|
| ||||||
;* | R3 = number of bytes to | * |
|
|
|
|
|
|
| ||||||||||
;* | R4 = page address MSB(byte) |
|
|
|
| * |
|
|
|
|
|
|
| ||||||
;* | R5 = page address LSB(byte) |
|
|
|
| * |
|
|
|
|
|
|
| ||||||
;* | R7 = pointer to data buffer in RAM(byte) | * |
|
|
|
|
|
|
| ||||||||||
;* Outputs: |
|
|
|
|
|
|
|
|
| * |
|
|
|
|
|
|
| ||
;* | R7 = status (byte) | set on error |
|
| * |
|
|
|
|
|
|
| |||||||
;* | C = clear on no error, |
|
| * |
|
|
|
|
|
|
| ||||||||
LOAD | EQU | 00H |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EP | EQU | 68H |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PGM_USER: | FMCON,#LOAD | ;load command, clears page register |
|
|
| ||||||||||||||
| MOV |
|
|
| |||||||||||||||
| MOV | FMADRH,R4 | ;get high address |
|
|
|
|
|
|
|
| ||||||||
| MOV | FMADRL,R5 | ;get low address |
|
|
|
|
|
|
|
| ||||||||
| MOV | A,R7 |
|
|
| ; |
|
|
|
|
|
|
|
|
|
|
|
|
|
| MOV | R0,A |
|
|
| ;get pointer into R0 |
|
|
|
|
|
| |||||||
LOAD_PAGE: | FMDAT,@R0 | ;write data to page register |
|
|
|
|
| ||||||||||||
| MOV |
|
|
|
|
| |||||||||||||
| 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 |
|
|
|
|
|
| |||||||
BAD: | RET |
|
|
|
| ;and return |
|
|
|
|
|
|
|
|
|
| |||
SETB | C |
|
|
| ;set error flag |
|
|
|
|
|
|
|
| ||||||
|
|
|
|
|
|
|
|
|
|
|
| ||||||||
| RET |
|
|
|
| ;and return |
|
|
|
|
|
|
|
|
|
| |||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003 Dec 8 | 91 |