欢迎来到天天文库
浏览记录
ID:25410447
大小:56.50 KB
页数:10页
时间:2018-11-20
《《键盘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.SetDisplayPos(2,0);//
2、汉字定位到上行左端 Lcd.Display("汉字显示演示56"); Lcd.SetDisplayPos(3,0);//汉字定位到上行左端 Lcd.Display("汉字显示演示78"); EALLOW;// PieCtrlRegs.PIEACK.all=0xFFFF;//PIEACK_GROUP1; PieCtrlRegs.PIEACK.bit.ACK7=1; EDIS; EINT; //EnableGlobalinterruptINTM ERTM; //EnableGlobalrealtimeinterr
3、uptDBGM for(;;) { asm("nop"); //Resetthewatchdogcounter KickDog(); }}#include"keyboard.h"KeyboardObj::KeyboardObj(void){ Init();}voidKeyboardObj::Init(void){ for(inti=0;i4、void){typedefvoid(KeyboardObj::*FunctionPtr)(void);//函数指针staticconstFunctionPtrKeyboardCommandTab[3][KeyboardNumbers]={ { &KeyboardObj::Key01, &KeyboardObj::Key02, &KeyboardObj::Key03, &KeyboardObj::Key04, &KeyboardObj::Key05, &KeyboardObj::Key06, 5、 &KeyboardObj::Key07, &KeyboardObj::Key08 },//放键表 { &KeyboardObj::Key11, &KeyboardObj::Key12, &KeyboardObj::Key13, &KeyboardObj::Key14, &KeyboardObj::Key15, &KeyboardObj::Key16, &KeyboardObj::Key17, &KeyboardObj::Key186、 },//短压表 { &KeyboardObj::Key21, &KeyboardObj::Key22, &KeyboardObj::Key23, &KeyboardObj::Key24, &KeyboardObj::Key25, &KeyboardObj::Key26, &KeyboardObj::Key27, &KeyboardObj::Key28 }//长压表};unsignedcharKeyCount; Count%=KeyboardNu7、mbers; KeyCount=PressCount[Count];//取压键次数 if(Scan()==Count+1)//有键压下 { KeyCount++;//压键计数 if(KeyCount>=KeyboardPushTimes) { if(KeyCount==KeyboardPushTimes)//短压键 {// System.B
4、void){typedefvoid(KeyboardObj::*FunctionPtr)(void);//函数指针staticconstFunctionPtrKeyboardCommandTab[3][KeyboardNumbers]={ { &KeyboardObj::Key01, &KeyboardObj::Key02, &KeyboardObj::Key03, &KeyboardObj::Key04, &KeyboardObj::Key05, &KeyboardObj::Key06,
5、 &KeyboardObj::Key07, &KeyboardObj::Key08 },//放键表 { &KeyboardObj::Key11, &KeyboardObj::Key12, &KeyboardObj::Key13, &KeyboardObj::Key14, &KeyboardObj::Key15, &KeyboardObj::Key16, &KeyboardObj::Key17, &KeyboardObj::Key18
6、 },//短压表 { &KeyboardObj::Key21, &KeyboardObj::Key22, &KeyboardObj::Key23, &KeyboardObj::Key24, &KeyboardObj::Key25, &KeyboardObj::Key26, &KeyboardObj::Key27, &KeyboardObj::Key28 }//长压表};unsignedcharKeyCount; Count%=KeyboardNu
7、mbers; KeyCount=PressCount[Count];//取压键次数 if(Scan()==Count+1)//有键压下 { KeyCount++;//压键计数 if(KeyCount>=KeyboardPushTimes) { if(KeyCount==KeyboardPushTimes)//短压键 {// System.B
此文档下载收益归作者所有