Philips P89LPC902 ユーザーズマニュアル

ページ / 114
Philips Semiconductors
User’s Manual - Preliminary -
P89LPC901/902/903
FLASH PROGRAM MEMORY
2003 Dec 8     
99
Figure 14-6: C-language routine to read a flash element
User Configuration Bytes
A number of user-configurable features of the P89LPC901/902/903 must be defined at power-up and therefore cannot be set by 
the program after start of execution. These features are configured through the use of  Flash byte UCFG1 shown in Figure 14-7.
#include <REG921.H> 
 
unsigned char READ_EL (unsigned char); 
unsigned char GET_EL; 
 
void main () 
 

 
GET_EL = READ_EL(0x02); 

 
unsigned char READ_EL (unsigned char el_addr) 
 { 
 
 
#define CONF 
0x6C   
// access flash elements 
 
 
unsigned char el_data; 
 
// local for element data 
 
FMADRL 
= el_addr; 
 
 
//write element address to addr reg 
 FMCON 
CONF; 
  //access 
flash 
elements 
command 
 
el_data 
= FMDATA;   
 
/read the element data 
 return(el_data);