#include<reg52.h>
#include <intrins.h>
#define uint unsigned int
#define uchar unsigned char
sbit P2_0=P2^0;
uchar tt,a,num;
void main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
a=0xfe;
IT0=0;
while(1);
}
void timer0() interrupt 0
{
if(num==2)
{
tt=0;
P2=a;
a=_crol_(a,2);
}
}
void timer1() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
tt++;
if(tt==2)
{
tt=0;
P2=a;
IE0=0;
a=_crol_(a,1);
}
}
为什么实现不了 按键按下后没反应啊 想了好久都没想到 求大神啊 |