⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 per.i

📁 该模板使用于周立功公司研发的EasyARM2100系列开发板
💻 I
字号:
#line 1 "src\\per.c"
#line 1 "src\\config.h"























 












typedef unsigned char  uint8;                    
typedef signed   char  int8;                     
typedef unsigned short uint16;                   
typedef signed   short int16;                    
typedef unsigned int   uint32;                   
typedef signed   int   int32;                    
typedef float          fp32;                     
typedef double         fp64;                     

 
 
 
 



#line 1 "src\\LPC2294.h"


























 

 
 





 
 






 
 


 
 





 
 



 
 


  
 


 
 


 
 



 
 
#line 122 "src\\LPC2294.h"

 
 




 
 

























 
 
#line 168 "src\\LPC2294.h"

 
 
#line 183 "src\\LPC2294.h"

 
 
#line 193 "src\\LPC2294.h"

 
 
#line 203 "src\\LPC2294.h"

 
 
#line 213 "src\\LPC2294.h"

 
 
 






 












 





 
#line 252 "src\\LPC2294.h"

 
 
#line 278 "src\\LPC2294.h"

#line 302 "src\\LPC2294.h"

#line 326 "src\\LPC2294.h"

#line 350 "src\\LPC2294.h"

#line 374 "src\\LPC2294.h"

#line 398 "src\\LPC2294.h"





#line 411 "src\\LPC2294.h"


 
 
#line 431 "src\\LPC2294.h"



 
 
#line 452 "src\\LPC2294.h"



 
 
#line 472 "src\\LPC2294.h"

 
 



 






 
 


 
 
#line 517 "src\\LPC2294.h"

 
 





 
 
#line 534 "src\\LPC2294.h"














































 


#line 595 "src\\LPC2294.h"

#line 605 "src\\LPC2294.h"

#line 619 "src\\LPC2294.h"







 
#line 54 "src\\config.h"
#line 1 "src\\system.h"










#line 1 "src\\target.h"





























 










extern void Reset(void);
















 

extern void TargetInit(void);


















 





 



 
#line 12 "src\\system.h"

#line 1 "src\\sys_init.h"





extern 	void	init_sys(void);
extern 	void 	init_io(void);
extern 	void 	init_clock(void);
extern 	void 	init_timer0(void);
extern 	void 	init_timer1(void);
extern 	void 	init_int0(void);
extern 	void 	init_int2(void);

#line 14 "src\\system.h"













 
















 




















#line 55 "src\\config.h"
 
 
 
 



 
 
 
 
 
 

						    

						    

						    

						    

#line 78 "src\\config.h"

   extern  void ee_write(unsigned char address , unsigned char data);
   extern unsigned char ee_read(unsigned char address);	
   extern void write_enable(void);
   extern void write_disable(void);
   extern void Delay(uint32 dly);






 
#line 2 "src\\per.c"
















 	
 void Delay(uint32 dly)
{
	uint32 i;uint32 j;
	for(j=0;j<dly;j++)
	{
		for(i=0;i<9;i++);
	}
}













 	
 void write_enable(void)
{  
  uint8  i=0;
  uint8 dump=0xc0; 
   
  cs_set;    
  Delay(1);

  sck_clr;   
  si_set;    
  Delay(1);
  sck_set;   

  Delay(1);
  sck_clr;   
  si_clr;    
  Delay(1);
  sck_set;   

  Delay(1);
  sck_clr;   
  si_clr;    
  Delay(1);
  sck_set;   


  for(i=0;i<7;i++)
  {  Delay(1);   
     sck_clr;       
     if(dump&0x80)   si_set;
     else            si_clr;
	 Delay(1);
    sck_set;      
    dump=(dump<<1);
   }
   Delay(1);
   sck_clr;        
   Delay(1);
   cs_clr;         

} 
 












 
void write_disable(void)
{
  uint8  i=0;
  uint8 dump=0x00; 
 
  cs_set;    
  Delay(1);

  sck_clr;   
  si_set;    
  Delay(1);
  sck_set;   

  Delay(1);
  sck_clr;   
  si_clr;    
  Delay(1);
  sck_set;   

  Delay(1);
  sck_clr;   
  si_clr;    
  Delay(1);
  sck_set;   

  for(i=0;i<7;i++)
  {  Delay(1);   
     sck_clr;       
     if(dump&0x80)   si_set;
     else            si_clr;
	 Delay(1);
    sck_set;      
    dump=(dump<<1);
   }
   Delay(1);
  sck_clr;        
   Delay(1);
  cs_clr;         
}













 
void ee_write(unsigned char address , unsigned char data)
{
   uint8  i=0; 
   uint32 rd_tmp;
   write_enable();
  
   address=address|0x80;
   
   Delay(1);   
   cs_set;    
   Delay(1);

   sck_clr;   
   si_set;    
   Delay(1);
   sck_set;   

   Delay(1);
   sck_clr;   
   si_clr;    
   Delay(1);
   sck_set;   

  
  for(i=0;i<8;i++)
     {
	 Delay(1);
     sck_clr;           
     if(address&0x80)   si_set;
     else               si_clr;
     Delay(1);
     sck_set;         
     address=address<<1;
     }

  for(i=0;i<8;i++)
     {
     Delay(1);
     sck_clr;           
     if(data&0x80)   si_set;
     else            si_clr;
     Delay(1);
     sck_set;           
     data=data<<1;
     }

    Delay(1);
	sck_clr;
    cs_clr;             



 	Delay(1);
    cs_set;             
 while(1)
    {
     sck_clr;           
	 Delay(1);
     sck_set;           
	 Delay(1);
	 rd_tmp	=(*((volatile unsigned long *) 0xE0028000));
	 rd_tmp	&=0x00010000;
	 if(0x00010000==rd_tmp) break;
    }
    cs_clr;             
 	write_disable();  
}













 
 unsigned char ee_read(unsigned char address)
{
  
   uint8 i=0;
   uint8  rd_data;
   
   cs_set;            
   Delay(1);

  sck_clr;   
  si_set;    
  Delay(1);
  sck_set;   

  Delay(1);
  sck_clr;   
  si_set;    
  Delay(1);
  sck_set;   

  Delay(1);
  sck_clr;   
  si_clr;    
  Delay(1);
  sck_set;   
    
  address=(address<<1);
 for(i=0;i<8;i++)
    {
     Delay(1);
     sck_clr;           
     if(address&0x80)   si_set;
     else            si_clr;
     Delay(1);
     sck_set;           
     address=(address<<1); 
    }

  
	rd_data=0;
 for(i=0;i<8;i++)
    {  
	rd_data=rd_data<<1;
       sck_set;           
	  Delay(1);  
	 
	
	
	   if( ((*((volatile unsigned long *) 0xE0028000))&0x00010000)!=0 ) 
		{
			rd_data=rd_data | 0x01;
		
		}
		else
		{
			;	
		}		

       sck_clr;           
	   Delay(1);
	   
    }
     Delay(1); Delay(1);
    cs_clr;             
    return rd_data;
}  



       

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -