?????C?????????????????????????
/* ???????????????????
????????°???????????????????????????
*/
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit Key=P1^7;
sbit DoorBell=P3^0;
uint p=0;
//??????
void main()
{
DoorBell=0;
TMOD=0x00; //T0 ??? 0
TH0=(8192-700)/32; //700us ???
TL0=(8192-700)%32;
IE=0x82;
while(1)
{
if(Key==0) //???°????????????
{
TR0=1;
while(Key==0);
}
}
}
void Timer0() interrupt 1
{
DoorBell=~DoorBell;
p++;
if(p<400) //????????????????????? 400 ?? 800
{
TH0=(8192-700)/32; //700us ???
TL0=(8192-700)%32;
}
else if(p<800)
{
TH0=(8192-1000)/32; //1ms ???
TL0=(8192-1000)%32;
}
else
{
TR0=0;
p=0;
}
}
???????????????? 8X8LED ???????????γ???

????admin ?????????2018-05-19