| 我把EEPROM的读写代码贴出来吧,大家看看 
 /**********************************************************************************
 LPC9XX内部EEPROM操作函数
 操作方式:单字节
 **********************************************************************************/
 void EEPROMwrite(unsigned int adr, unsigned char dat)
 {
 uchar OK=0;
 EA=0;
 while(OK==0)
 {          // disable Interrupts during write
 DEECON=0;  // mode: write byte, set address
 DEEDAT=dat;         // set write data
 DEEADR=(unsigned char) adr;     // start write
 while((DEECON&0x80)==0);     // wait until write is complete
 DEECON &= 0x7F;
 Delay(100);
 EA=0;
 if(dat == EEPROMread(adr))
 {
 OK = 1;
 }
 }
 EA=1;
 
 }
 
 
 unsigned char EEPROMread(unsigned int adr)
 {
 EA=0;
 DEECON=0;  // mode: read byte, set adress
 DEEADR=(unsigned char) adr;     // start read
 while((DEECON&0x80)==0);     // wait until read is complete
 
 EA=1;
 return DEEDAT;        // return data
 }
 
 
 
 
 还有CCU的初始化代码:
 /****************************************************************************************
 CCU初始化,CCU产生PWM用于电机调速
 ****************************************************************************************/
 void CCU_init(void)
 {
 OCD=1;          //enable ports P2.1
 TPCR2H=0x00; // set CCU Prescaler:
 TPCR2L=0xC7; // divide by 200 (199+1)  0x08
 TCR21=0x06;  // Prescaler for Phase Locked Loop:
 // Input frequency must be in range of 0.5-1Mhz
 // InpFrq=PCLK/(PLLDIV+1)=(CCLK/2)/(PLLDIV+1)
 // using the internal RC oscillator: CCLK=7.373MHz
 //   PLLDiv=6, 6+1=7      => 0.5266 MHz
 // using Crystal 11.0592 MHz => 0.789 MHz
 CCCRD=0x02;  // inverted PWM output on channel D
 //TCR20=0x80;  // Start PLL, OutputMode: stop
 PLLEN = 1;
 NOP;
 NOP;
 while(PLLEN==0);// wait until PLL locked
 TOR2H=0x00;  // Reload Value 0x00FF=255
 TOR2L=0xFF;  // -> PWM period
 TCR21|=0x80; // update reload value
 OCRDH=0x00;  // initialize Duty-Cycle
 OCRDL=0xFE;
 TCR21|=0x80; // update duty cycle
 TCR20=0x82;  // Set output mode: asymmetrical PWM,Up Conter
 }
 |