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

📄 test27.c

📁 5402开发板附带的源程序
💻 C
字号:
#pragma CODE_SECTION(vect,"vect") 

int char1[32][16]={{0x00,0x10,0x21,0x86,0x60,0x90,0x90,0x0fe,0x90,0x90,0x00,0x0fe,0x92,0x92,0x0fe,0x02},
			{0x00,0x20,0x20,0x20,0x20,0x0fe,0x00,0x00,0x00,0x0fe,0x40,0x20,0x30,0x18,0x10,0x00},
			{0x80,0x80,0x40,0x40,0x0a0,0x10,0x08,0x07,0x08,0x10,0x0a0,0x20,0x40,0x0c0,0x40,0x00},
			{0x08,0x08,0x08,0x0c8,0x7f,0x48,0x48,0x48,0x48,0x0e8,0x48,0x0c,0x08,0x00,0x00,0x00},
			{0x00,0x24,0x24,0x0A4,0x0FE,0x0A3,0x22,0x00,0x24,0x48,0x00,0x0fe,0x00,0x80,0x00,0x00},
			{0x10,0x10,0x10,0x0fe,0x90,0x50,0x00,0x48,0x0C8,0x48,0x7F,0x48,0x48,0x0CC,0x08,0x00},
			{0x00,0x00,0x80,0x40,0x30,0x0C,0x00,0x0C0,0x06,0x18,0x20,0x40,0x80,0x80,0x80,0x00},
			{0x10,0x10,0x92,0x92,0x92,0x92,0x92,0x92,0x0D2,0x9A,0x12,0x02,0x0fe,0x02,0x00,0x00},
			{0x00,0x0FC,0x14,0x0D4,0x54,0x54,0x54,0x0D4,0x14,0x0fe,0x04,0x85,0x66,0x04,0x00,0x00},
			{0x40,0x42,0x0CC,0x00,0x0FC,0x56,0x55,0x54,0x0FE,0x24,0x20,0x20,0x0fe,0x20,0x20,0x00},
			{0x40,0x20,0x10,0x0FC,0x23,0x10,0x8C,0x67,0x04,0x0F4,0x04,0x44,0x9C,0x8C,0x00,0x00},
			{0x00,0x40,0x20,0x0F8,0x07,0x04,0x0F4,0x14,0x14,0x14,0x0fe,0x14,0x14,0x14,0x0F6,0x04},
			{0x00,0x00,0x00,0x0FE,0x22,0x22,0x22,0x22,0x0FE,0x22,0x22,0x22,0x22,0x0fe,0x02,0x00},
			{0x40,0x42,0x0C4,0x00,0x04,0x84,0x0C4,0x0B5,0x8E,0x84,0x84,0x64,0x04,0x06,0x04,0x00},
			{0x00,0x08,0x08,0x88,0x98,0x0E8,0x89,0x8E,0x88,0x0C8,0x0A8,0x98,0x0CC,0x88,0x80,0x00},
			{0x00,0x00,0x00,0x00,0x7E,0x22,0x22,0x0A2,0x22,0x22,0x22,0x22,0x7F,0x02,0x80,0x00},
			
			{0x00,0x04,0x0fc,0x03,0x00,0x1f,0x08,0x08,0x88,0x4f,0x30,0x0f,0x40,0x80,0x7f,0x00},
			{0x10,0x30,0x18,0x08,0x04,0x7f,0x00,0x00,0x00,0x3f,0x40,0x40,0x40,0x40,0x78,0x00},
			{0x40,0x20,0x10,0x08,0x07,0x08,0x30,0x40,0x20,0x18,0x07,0x08,0x30,0x60,0x40,0x00},
			{0x90,0x88,0x46,0x41,0x21,0x12,0x0c,0x0c,0x13,0x20,0x60,0x0c0,0x40,0x00,0x00,0x00},
			{0x10,0x08,0x06,0x01,0x07f,0x00,0x01,0x02,0x02,0x02,0x02,0x07f,0x01,0x01,0x01,0x00},
			{0x02,0x42,0x81,0x7F,0x00,0x40,0x40,0x40,0x21,0x16,0x08,0x14,0x23,0x40,0x40,0x00},
			{0x01,0x01,0x00,0x30,0x28,0x24,0x23,0x20,0x20,0x28,0x30,0x60,0x00,0x01,0x00,0x00},
			{0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x40,0x80,0x7F,0x00,0x00,0x00},
			{0x04,0x43,0x30,0x07,0x72,0x82,0x8A,0x93,0x0B4,0x82,0x0E1,0x12,0x24,0x64,0x07,0x00},
			{0x00,0x00,0x3F,0x52,0x2B,0x12,0x4A,0x86,0x7F,0x01,0x46,0x80,0x7F,0x00,0x00,0x00},
			{0x40,0x30,0x00,0x77,0x80,0x81,0x88,0x92,0x0B4,0x83,0x88,0x0D0,0x30,0x11,0x60,0x00},
			{0x00,0x00,0x00,0x07f,0x00,0x80,0x43,0x45,0x29,0x19,0x17,0x21,0x21,0x41,0x0C3,0x40},
			{0x00,0x80,0x60,0x1F,0x02,0x02,0x02,0x02,0x7F,0x02,0x02,0x42,0x82,0x7F,0x00,0x00},
			{0x00,0x00,0x7F,0x20,0x90,0x88,0x50,0x48,0x24,0x13,0x08,0x14,0x23,0x0C0,0x00,0x00},
			{0x80,0x40,0x30,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
			{0x00,0x00,0x07f,0x41,0x41,0x41,0x41,0x07f,0x01,0x07f,0x41,0x41,0x41,0x41,0x07f,0x01}};	  
				  
				  
				  
				  
   
unsigned int *pmem=0;
unsigned int  READ;


#define PMST   *(pmem+0x001D)
#define SWCR   *(pmem+0x002B)
#define SWWSR  *(pmem+0x0028)
#define BSCR   *(pmem+0x0029)
#define READS  *(pmem+0x4000)
#define IMR    *(pmem+0x0000)
#define IFR    *(pmem+0x0001)
#define TIM0   *(pmem+0x0024)  /* timer0 register */
#define PRD0   *(pmem+0x0025)  /* timer0 period register */
#define TCR0   *(pmem+0x0026)  /* timer0 control register */

int time1_over;

void cpu_init()
{
   PMST=0x3fa0;
   SWWSR=0x7fff;
   BSCR=0x0002;
   SWCR=0x0000;
   IMR=0;
   IFR=IFR;
} 

void set_t0()    
{
   asm(" ssbx intm");
   TCR0=0x0a18;
   PRD0=0x0007;       
   IMR=IMR|0x0008;
   IFR=IFR;
   asm(" rsbx intm");
}

void busy()
{
   TCR0=0x0a21;  
   PRD0=0x020; 
   while(time1_over==0);
   time1_over=0;
}
      
main()
{
   unsigned int i,j,k; 
   cpu_init();
   set_t0();
   time1_over=0;

/*********LCD initializtion*************/  
   /*reset*/
	READS=0x03e2; 
	busy();   
	READS=0x01e2;  
	busy();
	
	  
	READS=0x05e2;
	busy();
	READS=0x01e2;
	busy();
   
   /* select dynamic driving*/
	READS=0x03a4; 
	busy();
	READS=0x01a4;  
	busy(); 

   
	READS=0x05a4;
	busy();
	READS=0x01a4;
	busy();

   /*select 1/32 duty radio*/   
	READS=0x03a9; 
	busy();
	READS=0x01a9;  
	busy();
   
	READS=0x05a9;
	busy();
	READS=0x01a9;
	busy();

   /*ADC select*/
 	READS=0x03a0; 
	busy();
	READS=0x01a0;  
	busy(); 

	READS=0x05a0;
	busy();
	READS=0x01a0;
	busy();
    
    /*selec display start line*/
	READS=0x03c0; 
	busy();
	READS=0x01c0;  
	busy();

	READS=0x05c0;
	busy(); 
	READS=0x01c0;
	busy();

    /*display on*/
 	READS=0x03af; 
	busy();
	READS=0x01af;
	busy();

	READS=0x05af;
	busy();
	READS=0x01af;
	busy();
  
   /*cls*/
    for(i=0;i<4;i++)
    {
     
  		READS=0x03B8+i; 
		busy(); 
		READS=0x01B8+i;
		busy();
	
		READS=0x0300; 
		busy(); 
		READS=0x0100;
		busy();
	
	    for(j=0;j<61;j++)
	   	{
			READS=0x1300;
   	    	busy();
   	    	READS=0x1100;
   	    	busy(); 
  	 	}    

    	READS=0x05B8+i; 
		busy(); 
		READS=0x01B8+i;
		busy();
		READS=0x0500; 
		busy(); 
		READS=0x0100;
		busy();	
		for(j=0;j<61;j++)
   		{
   			READS=0x1500; 
			busy();
   	   		READS=0x1100;
   	    	busy();
    	}     
    
    }   
    
    /*write display data*/
	/*page0 column0*/
	READS=0x03B8; 
	busy();
	READS=0x01B8;
	busy(); 
	READS=0x0300; 
	busy(); 
	READS=0x0100;
	busy();	

 	for(k=0;k<4;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1300|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}  
   	READS=0x05B8; 
	busy();
	READS=0x01B8;
	busy();
	READS=0x0500; 
	busy(); 
	READS=0x0100;
	busy();	
	for(k=4;k<8;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1500|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}
   	
   	/*page1 column0*/
   	READS=0x03B9; 
	busy();
	READS=0x01B9;
	busy(); 
	READS=0x0300; 
	busy(); 
	READS=0x0100;
	busy();	

 	for(k=16;k<20;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1300|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}  
   	READS=0x05B9; 
	busy();
	READS=0x01B9;
	busy();
	READS=0x0500; 
	busy(); 
	READS=0x0100;
	busy();	
	for(k=20;k<24;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1500|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}
     
    /*page2 column0*/  
    READS=0x03Ba; 
	busy();
	READS=0x01Ba;
	busy(); 
	READS=0x0300; 
	busy(); 
	READS=0x0100;
	busy();	

 	for(k=8;k<12;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1300|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}  
   	READS=0x05Ba; 
	busy();
	READS=0x01Ba;
	busy();
	READS=0x0500; 
	busy(); 
	READS=0x0100;
	busy();	
	for(k=12;k<16;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1500|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}
   	 
   	/*page3 column0*/
   	READS=0x03Bb; 
	busy();
	READS=0x01Bb;
	busy(); 
	READS=0x0300; 
	busy(); 
	READS=0x0100;
	busy();	

 	for(k=24;k<28;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1300|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}  
   	READS=0x05Bb; 
	busy();
	READS=0x01Bb;
	busy();
	READS=0x0500; 
	busy(); 
	READS=0x0100;
	busy();	
	for(k=28;k<32;k++)
   	for(j=0;j<15;j++)   
   	{
   		READS=0x1500|char1[k][j];  
   	   	busy(); 
	   	READS=0x1100|char1[k][j];
   	   	busy(); 
   	}   
       

}  
   
   
interrupt void tint0()        
{  
   time1_over=1;     
} 

void vect()
{
   asm(" .ref _c_int00");
   asm(" .ref _tint0");

   asm(" b _c_int00");  /* reset */
   asm(" nop");
   asm(" nop");
   asm(" rete");        /* nmi  */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* int0 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* int1 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* int2 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" b _tint0");   /* tint0 */
   asm(" nop");
   asm(" nop");
   asm(" rete");      /* brint0 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");      /* bxint0 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");      /* dmac0 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* tint1 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* int3 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* hpint */
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* brint1 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* bxint1 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");       /* dmac4 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" rete");     /* dmac5 */
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" nop");
   asm(" nop");
}


⌨️ 快捷键说明

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