Philips UM10109 Microscope & Magnifier User Manual


 
© Koninklijke Philips Electronics N.V. 2005. All rights reserved.
User manual Rev. 02 — 23 May 2005 112 of 133
Philips Semiconductors
UM10109
P89LPC932A1 User manual
;*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
A C-language routine to load the page register and perform an erase/program operation is
shown below.
#include <REG931.H>
unsigned char idata dbytes[64]; // data buffer
unsigned char Fm_stat; // status result
bit PGM_USER (unsigned char, unsigned char);
bit prog_fail;
void main ()
{
prog_fail=PGM_USER(0x1F,0xC0);
}
bit PGM_USER (unsigned char page_hi, unsigned char page_lo)
{
#define LOAD0x00// clear page register, enable loading
#define EP 0x68// erase & program page
unsigned char i;// loop count