?? tickisr.c
字號:
#include <e51.h>
#include <reg51.h>
#define OFF 0
#define ON 1
uchar Tick=0;
uchar Key;
extern uchar DisBuf[4] ;
extern unsigned int ReadTemperature(void);
void tickISR () interrupt 1
{
static uchar LedPos =0;
static uchar Key_Sta=OFF;
static uchar Key_time=0;
TH0=-2000/256;
TL0=-2000%256;
LedPos++;//Led show pos
if(LedPos==4) LedPos=0;
Tick++;//tick
if(Tick>=50) Tick=0;//1s
DisBuf[LedPos]|=(LedPos<<4);
P2= DisBuf[LedPos];
if((P3&0x0c)!=0x0c&&Key_Sta==OFF) {Key_Sta=ON; Key=P3&0x0c;}
if(Key_Sta==ON) Key_time++;
//if(Key_time==1&&Key_Sta==ON) Key=P3&0x0c;
if((P3&0x0c)==0x0c&&Key_Sta==ON)
{
// P17=~P17;
Key_Sta=OFF;
Key_time=0;
// if(Key_time>49&&Key==0x04){Key|=0x40;Key_time=0;}
Key|=0x80;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -