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

📄 main.c

📁 S3C44B0X全套培训资料及源代码,ARM 并行口仿真器的使用.
💻 C
字号:
#include "..\startup\44b.h"#include"..\ucos-ii\includes.h"   #include"..\inc\Uhal.h"unsigned char MykeyBoard_KeyMap[]={1,4,7,10,2,5,8,0,3,6,9,11,12,13,14,15};//10-退格,11-*/.,12-↑,13-↓,14-确定,15-取消unsigned short  MyGetScanKey();unsigned int  MyGetKey();int Main(int argc, char **argv){unsigned int key;unsigned int tempkey=0;Uart_SendByte(0,0xa);//换行Uart_SendByte(0,0xd);//回车       	for (;;){				key=MyGetKey();		key&=0x000f;		if(key>9){			Uart_SendByte(0,0x31);			tempkey=key-10;			Uart_SendByte(0,tempkey|=0x0030);			}		else	      	Uart_SendByte(0,key|0x0030);	       Uart_SendByte(0,0x2c);	}return 0;}unsigned short  MyGetScanKey(){	unsigned short key;	unsigned int i,temp;	for(i=1;i<0x10;i<<=1){		rPDATE|=0xf0;		rPDATE&=~(i<<4);		key<<=4;		Delay(10);		temp=rPDATC;		key|=(temp&0xf);	}	return key;}unsigned int  MyGetKey(){	int i;	unsigned short key,tempkey=1;	static unsigned short  oldkey=0xffff;	static unsigned char  keystatus=0;	unsigned char  keycnt=0;	while(1){		key=0xffff;		while(1){			key=MyGetScanKey();			if(key!=0xffff)				break;			Delay(200);			oldkey=0xffff;			}		Delay(500);		if(key!=MyGetScanKey())			continue;		if(oldkey!=key){			keystatus=0;		}		if(keystatus==0){	//第一次按下此键			keycnt=0;			keystatus=1;		}		else if(keystatus==1){	//第二次重复此键			keycnt++;			if(keycnt==20)				keystatus=2;			else				continue;		}		oldkey=key;		break;	}		for(i=0;i<16;i++){	//查找按键,不包括功能键		if((key&tempkey)==0)			break;		tempkey<<=1;	}	return MykeyBoard_KeyMap[i];}

⌨️ 快捷键说明

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