#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
int keyscan()
{
unsigned char key;
byte temp=0;
DDRB=0x00;
DDRT=0x0f;
while(PTT==0x0e){
if(PORTB&0xf0!=0xf0)
{
temp=PORTB&0xf0;
switch(temp)
{
case 0xe0: key=1;break;
case 0xd0: key=2;break;
case 0xb0: key=3;break;
case 0x70: key=4;break;
}
return key;
}
}
while(PTT==0x0d)
{
if(PORTB&0xf0!=0xf0)
{
temp=PORTB&0xf0;
switch(temp)
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载