ImageVerifierCode 换一换
格式:DOCX , 页数:29 ,大小:27.34KB ,
资源ID:8136353      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-8136353.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(《KEY按键应用》大全文档格式.docx)为本站会员(b****3)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

《KEY按键应用》大全文档格式.docx

1、bit Hbit;Hbit=HandSignal;/*采样信号线*/if (NewKey=FALSE)/*如果上一次按键事件已经北处理*/switch (ib_HandState) /*根据接收状态散转*/case LEAD:/*引导头接收情况*/if (Hbit) /*如果信号线是高电平*/if (ib_LowTimeMIN_LeadTime)&(ib_LowTimeMAX_LeadTime)/*判断低电平时间是否超时*/ib_HandState=RESTART; /*是的话复位接收程序*/break; case START:/*同步头接收情况*/if(Hbit)/*如果信号线是高电平*/i

2、b_HighTime+;/*高电平时间计数器加一*/if (ib_HighTimeMAX_SynTime)/*如果高电平时间超长,复位接收程序*/ /*如果信号线是低电平*/if (ib_HighTimeMIN_SynTime)&(ib_HighTime=1;/*接收数据字节右移一位*/MIN_B1TIME)&MAX_B1TIME) /*如果高电平宽度符合逻辑1标准,接收字节高位置一*/ib_KeyCodeib_KeyPoint+=0x80; ib_BitCount+;/*接收数据位计数器加一*/if (ib_BitCount7) /*如果接收满一个字节*/ib_BitCount=0; /*清

3、空位计数器*/ib_KeyPoint+;/*指向下一个字节*/if (ib_KeyPoint3)/*如果接收完整个数据*/unsigned char i;NewKey=TRUE;/*置有新键按下标志*/for (i=0;i4;i+) /TI=0; /SBUF=ib_KeyCode; /while(!TI);/ /ib_HandState=RESTART; ib_HighTime=0; /*将高电平时间计数器清零*/*设定系统为等待上升沿状态*/default:if (ib_HandState=RESTART)/*如果程序处于复位状态*/ /*复位各项参数*/ib_HandState=LEAD;

4、ib_KeyCode0=0; ib_KeyCode1=0;ib_KeyCode2=0; ib_KeyCode3=0;ib_KeyPoint=0;NewKey=FALSE;好多遥控器(无线,红外)发射数据都是PPM调制的,以上程序稍微改动后可以应用于各种PPM调制信号的场合。44矩阵式键盘识别技术#include unsigned char ID;void delay10ms(void) unsigned char i,j;for(i=20;i0;i-)for(j=248;jj-); void delay02s(void) unsigned char i;delay10ms();void mai

5、n(void) while(1) if(P3_7=0) if(P3_7=0) ID+;if(ID=4) ID=0;while(P3_7=0);switch(ID) case 0:P1_0=P1_0;delay02s();case1:P1_1=P1_1;case 2:P1_2=P1_2;case 3:P1_3=P1_3;支持键盘双击事件的C程序设计!/*KeyBoard Encode ProgramThis Program can encode press_key up to 128 and it can deal KB_DBClick MessageThis is just a test pr

6、oram and only use 2 key.If More Key need to Encode ,please modify the function:KBKeyPress() This Porgram use Message_Driver method,the KB_Msg is used to record what KB_Msg has occured.The meaning of SysKBMsg is list as following. Program Design:LiBaizhanVer:1.10Date:2003-3-16*/reg51.hintrins.hsbitKe

7、y1 =P10;Key2P11; Some System Var Pre_Definition Crystal Frequence is 11.0592MHz#defineTIME_2MS 0X74TIME_20MS0X043BKB_INTERNAL 3/*Key DBClk Detection Internal */SysKBMsg define Keyboard Message,it include Single_Click or Double_ClickIts bit6bit0 record key_encode and bit 7 record DBClk(1) or SglClk(0

8、)It can record and encode up to 127(27-1) keysNo key is press when it is 0This method did not deal key such as Ctrl_Key or Alt_Key or Shift_Key.etc./*_*/data unsigned char SysKBMsg=0;/*|7|6543210|*/*| D/S | KB6 | KB5 | KB4 | KB3 | KB2 | KB1 | KB0 |*/data unsigned char KBCounter=0;bitKBCounterStart=0

9、;KBCounterStop=0;/*if KeyBoard counter stop then this bit is 1*/KBCounterFlag=0;/*Current Counter is used by KeyBoard*/void TimerInt0(void) interrupt 1 /*timer 0 interrupt use to record how long key is press*/TR0=0;if(KBCounterFlag) /*Current Counter is used by KeyBoard*/if(KBCounterKB_INTERNAL)/*if

10、 DBClk Detection is not finish then detect continue*/KBCounter+;TR0=1;elseKBCounter=0;/*DBClk Detection is finish*/KBCounterStop=1;void DelayMS(unsigned int dltime);void Init51(void);unsigned char KBKeyPress(void);/*only return what key is press*/void KBKeyEncode(void); /*encode which key is pressed

11、 and DBClk or SglClk*/void KBStartTimer(unsigned char CntH,unsigned char CntL);/*load counter initial value and start timer*/void KBStopTimer(void);void KBDealPressKey(void); /*deal key_press message*/Init51();while(1)KBKeyEncode(); /*recored what KeyBoard Msg occure:which key is press and single cl

12、k or db clk*/KBDealPressKey();Delay Time is :(20+17*dl_time)*12/CrystalFrequence(us)void DelayMS(unsigned int dltime)unsigned int i;for(i=0;dltime;i+);void Init51(void)SCON= 0x50; /* mode 1: 8-bit UART, enable receiverTMOD= 0x21; /* timer 1 mode 2: 8-Bit reload/* timer 0 mode 1: 16-bit TimerTH1= BAUD_4800;/* reload value 9600 baudTR1= 1; /* timer 1 runIE = 0X12; /* enable Serial INT,Timer0 INTES = 0; /* disable Serial INT*/EA = 1;

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2