#include
unsigned char code SEGtable[ ]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; //字符编码
sbit SEKey = P1 ^ 0; //启动、暂停和停止按键
sbit INCKey = P1 ^ 4; //速度增加键
sbit DECKey = P1 ^ 7; //速度减少键
sbit pauseLED = P3 ^ 0; //暂停指示灯
sbit stopLED = P3 ^ 7; //停止指示灯
bit keyFlg; //按键长按、短按标志位 0为短按 1为长按
unsigned char TimeCounter; //计数专用
unsigned char KeyDownFlg,set; //按键专用
unsigned char yansi,key,send,unitsdData,tensdData,num,keynum;
bit keybz;
//延时函数
void delay(unsigned char time)
{
unsigned char x,y;
for(x=time;x>0;x--)
{
for(y=110;y>0;y--);
}
}
//扫描启动、停止、暂停按键
void StartAndStopKeyScan()
{
if(SEKey == 0) //键被按下
{
KeyDownFlg = 1; //置键按下标志位
TR0 = 1; //启动定时器
}