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

📄 main.c

📁 7279是串行的LED键盘控制芯片
💻 C
字号:


#include "MAIN.H"



//-------------------------------------------------------------------------------
ubyte KEY;
bit key_flag=0;
//--------------------------------------------------------------------------------



//--------------------------------------------------------------------------------
void delay(uword i){

uword j;
for(;i>0;i--){
for(j=0;j<5500;j++);
}
return;
}


void MAIN_vInit(void)
{



  ///  Initialization of module 'GPIO'
  IO_vInit();
  INT_vInit();

  //   Interrupt Priority

  IP            =  0x00;         // load Interrupt Priority Register
  IPH           =  0x00;         // load Interrupt Priority High Register
  IP1           =  0x00;         // load Interrupt Priority 1 Register
  IPH1          =  0x00;         // load Interrupt Priority 1 High Register



  //   globally enable interrupts
  EA            =  1;           

} 

void main(void)
{
 

  MAIN_vInit();
  HD7279_SendByte(0xa4);//复位
  delay(10);
  
  HD7279_SendByte(0xbf);
  delay(600);
  HD7279_SendByte(0xa4);
  

  

  while(1)
  {	 if(key_flag){
  	switch(KEY){
	case 0:disp(0xc8,0);key_flag=0;break;
	case 1:disp(0xc8,1);key_flag=0;break;
	case 2:disp(0xc8,2);key_flag=0;break;
	case 3:disp(0xc8,3);key_flag=0;break;
	case 4:disp(0xc8,4);key_flag=0;break;
	case 5:disp(0xc8,5);key_flag=0;break;
	case 6:disp(0xc8,6);key_flag=0;break;
	case 7:disp(0xc8,7);key_flag=0;break;
	case 8:disp(0xc8,8);key_flag=0;break;
	case 9:disp(0xc8,9);key_flag=0;break;
	case 10:disp(0xc8,10);key_flag=0;break;	 //A
	case 11:disp(0xc8,11);key_flag=0;break;	 //B
	case 12:disp(0xc8,12);key_flag=0;break;	 //C
	case 13:disp(0xc8,13);key_flag=0;break;	 //D
	case 14:disp(0xc8,14);key_flag=0;break;	 //E
	case 15:disp(0xc8,15);key_flag=0;break;	 //F
	default:key_flag=0;break;	
	
	
	} //switch
  
  
  }//if
     
  }

return;
} 



⌨️ 快捷键说明

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