单片机使用状态机的键盘程序( scm using state machine keyboard program)

单片机使用状态机的键盘程序( scm using state machine keyboard program)

ID:16449929

大小:22.50 KB

页数:24页

时间:2018-08-09

单片机使用状态机的键盘程序( scm using state machine keyboard program)_第1页
单片机使用状态机的键盘程序( scm using state machine keyboard program)_第2页
单片机使用状态机的键盘程序( scm using state machine keyboard program)_第3页
单片机使用状态机的键盘程序( scm using state machine keyboard program)_第4页
单片机使用状态机的键盘程序( scm using state machine keyboard program)_第5页
资源描述:

《单片机使用状态机的键盘程序( scm using state machine keyboard program)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、51单片机使用状态机的键盘程序(51SCMusingstatemachinekeyboardprogram)IalsosendkeyboardprogramsusingstatemachinestosupportsinglekeysanddoublebondsSinglekey,keyboard,status,program,joininthefun1headerfile:KeyBoard.h#ifndef_Key_Board_h_#define_Key_Board_h_#defineKey_Up0x3E//arrow#defineKey_Down0x3D//downarrow#defin

2、eKey_Add0x3B//add#defineKey_Sub//0x37reduction#defineKey_Enter//0x2F.#defineKey_Return0x1F//returnThekeycombination#define0x33//Key_LR.Maythisdefinitionotherkeycombinations......#defineKey_NULL//0xFFwithoutanykeysSeveralfunctionsinthestatement/externalcallsExternvoidKey_Board_Init(void);//keyboard

3、interfaceinitializationExternU8Read_Key(void);//readkeyfunctionreturnsthekeyboardbufferinkeyExternvoidKey_In(void);//handlekeyinputfunction,thetimerinterruptinthecallExternvoidKey_Board_Test(void);//keyboardinterfacetestfunction(usedonlyinthecommissioningphase)#endif2sourcefile:KeyBoard.c//#includ

4、e"includes.h"//publicheaderfiles#include"Key_Board.h""//keyboardbufferrelatedconstantsdefined#defineKeyBuffLen//8keydefinitionofringbufferlengthis8(thesizeofthebuffercanbefreelydefinedasgreaterthan0.)//defineakeyboardbufferstructureStructStruct_KeyBoardBuff{U8buff[KeyBuffLen];//keyringbufferU8in;/

5、/writekeyinstructions(writetimerinterrupt)U8out;//readkeyindicator(Reader)}Key;/*************************************************************************Prototypeoffunction:voidKey_Board_Init(void)Function:initializethekeyboardinterface,thatis,thekeybufferisclearedAfferentparameter:NoneReturnparam

6、eter:NoneGlobalvariables:directmanipulationofthekeyboardbufferstructureDesign:MinisterWeiamo73@126.comModificationdate:2007-9-5Remark:itiscalledonlyoncethepowerupisinitialized**************************************************************************/VoidKey_Board_Init(void){Memset(&Key,0,sizeof(Ke

7、y));}/*************************************************************************Prototypeoffunction:U8Read_Key(void)Function:readakeyvaluefromthekeybufferAfferentparameter:NoneReturnparameter:U8keyvalue,ifthebuffe

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。