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

📄 key.c

📁 DSP2812资料,包括原理图,测试程序,使用说明,jjzhang166@163.com
💻 C
字号:
#include	"DSP28_Device.h"
void	delay(Uint32	num);
void	Fmq(void);

Uint16	ScanKey(void)
		{
			Uint16	temp,temp1;
			Uint16  flag = 0;
			while(flag==0)
				{
					temp = KeyReg;
					temp = temp & 0xff;
					while(temp==0xff)
						{
							temp = KeyReg;			
							temp = temp & 0xff;
		       			 }
		    		delay(2000);
					temp = KeyReg;			
					temp = temp & 0xff;
					temp1 = temp;
					if (temp == 0xff) flag = 0;
					else  flag = 1;		    
		        }
			temp = KeyReg;
			temp = temp & 0xff;
		    while( temp != 0xff)
		    	{
					temp = KeyReg;
					temp = temp & 0xff;
		    	}
		    return(temp1);		    			
		}


void	delay(Uint32  num)
		{
			volatile  Uint32  i;
			for (i=0;i<num;i++) { ; }				
		}	

void	KeyFunction(Uint16	Temp)
		{
			switch(Temp)
				{
					case  K1: {
								Fmq();
							  }
							  break;
					case  K2: {
								Fmq();
							  }
							  break;
					case  K3: {
								Fmq();
							  }
							  break;
					case  K4: {
								Fmq();
							  }
							  break;
					case  K5: {
								Fmq();
							  }
							  break;
					case  K6: {
								Fmq();	
							  }
							  break;
					default:  {
								Fmq();
							  }
							  break;
			}				  				  			  				   			  			  			   		
		}
void	Fmq(void)
		{
			Led8Lock = 0xFF;
			delay(500000);
			Led8Lock = 0xBF;			
		}				
//================================= end ===========================

⌨️ 快捷键说明

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