欢迎来到天天文库
浏览记录
ID:22710930
大小:47.00 KB
页数:10页
时间:2018-10-31
《《键盘c语言程序》word版》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、查看文章 在DSP2812上的键盘C++程序#include"main.h"classSystemObjSystem;classTimerObjTimer;classLcdObjLcd;classKeyboardObjKeyboard;intmain(void){ Lcd.SetDisplayPos(0,0);//汉字定位到上行左端 Lcd.Display("汉字显示演示12"); Lcd.SetDisplayPos(1,0);//汉字定位到上行左端 Lcd.Display("汉字显示演示34"); Lcd
2、.SetDisplayPos(2,0);//汉字定位到上行左端 Lcd.Display("汉字显示演示56"); Lcd.SetDisplayPos(3,0);//汉字定位到上行左端 Lcd.Display("汉字显示演示78"); EALLOW;// PieCtrlRegs.PIEACK.all=0xFFFF;//PIEACK_GROUP1; PieCtrlRegs.PIEACK.bit.ACK7=1; EDIS; EINT; //EnableGlobalinterruptI
3、NTM ERTM; //EnableGlobalrealtimeinterruptDBGM for(;;) { asm("nop"); //Resetthewatchdogcounter KickDog(); }}#include"keyboard.h"KeyboardObj::KeyboardObj(void){ Init();}voidKeyboardObj::Init(void){ for(inti=0;i4、 { PressCount[i]=0; } Count=0;}voidKeyboardObj::Exec(void){typedefvoid(KeyboardObj::*FunctionPtr)(void);//函数指针staticconstFunctionPtrKeyboardCommandTab[3][KeyboardNumbers]={ { &KeyboardObj::Key01, &KeyboardObj::Key02, &KeyboardObj::Key5、03, &KeyboardObj::Key04, &KeyboardObj::Key05, &KeyboardObj::Key06, &KeyboardObj::Key07, &KeyboardObj::Key08 },//放键表 { &KeyboardObj::Key11, &KeyboardObj::Key12, &KeyboardObj::Key13, &KeyboardObj::Key14, 6、 &KeyboardObj::Key15, &KeyboardObj::Key16, &KeyboardObj::Key17, &KeyboardObj::Key18 },//短压表 { &KeyboardObj::Key21, &KeyboardObj::Key22, &KeyboardObj::Key23, &KeyboardObj::Key24, &KeyboardObj::Key25, 7、 &KeyboardObj::Key26, &KeyboardObj::Key27, &KeyboardObj::Key28 }//长压表};unsignedcharKeyCount; Count%=KeyboardNumbers; KeyCount=PressCount[Count];//取压键次数 if(Scan()==Count+1)//有键压下 { KeyCount++;//压键计数 if(KeyCount>=KeyboardPus8、hTimes) { if(KeyCount==KeyboardPushTimes)//短压键 {// System.B
4、 { PressCount[i]=0; } Count=0;}voidKeyboardObj::Exec(void){typedefvoid(KeyboardObj::*FunctionPtr)(void);//函数指针staticconstFunctionPtrKeyboardCommandTab[3][KeyboardNumbers]={ { &KeyboardObj::Key01, &KeyboardObj::Key02, &KeyboardObj::Key
5、03, &KeyboardObj::Key04, &KeyboardObj::Key05, &KeyboardObj::Key06, &KeyboardObj::Key07, &KeyboardObj::Key08 },//放键表 { &KeyboardObj::Key11, &KeyboardObj::Key12, &KeyboardObj::Key13, &KeyboardObj::Key14,
6、 &KeyboardObj::Key15, &KeyboardObj::Key16, &KeyboardObj::Key17, &KeyboardObj::Key18 },//短压表 { &KeyboardObj::Key21, &KeyboardObj::Key22, &KeyboardObj::Key23, &KeyboardObj::Key24, &KeyboardObj::Key25,
7、 &KeyboardObj::Key26, &KeyboardObj::Key27, &KeyboardObj::Key28 }//长压表};unsignedcharKeyCount; Count%=KeyboardNumbers; KeyCount=PressCount[Count];//取压键次数 if(Scan()==Count+1)//有键压下 { KeyCount++;//压键计数 if(KeyCount>=KeyboardPus
8、hTimes) { if(KeyCount==KeyboardPushTimes)//短压键 {// System.B
此文档下载收益归作者所有