|
#include <reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit speak=P2^0;
sbit host = P2^2;
uchar GroupNo;
uchar code Seg7code[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80};
void delay1ms()
{
uchar i;
for(i=250;i>0;i--);
}
void ShowG(uchar no)
{
P1=Seg7code[no];
}
uchar KeySweep()
{
uchar temp,no=0;
if(P3!=0xff)
{
delay1ms();
if(P3!=0xff)
temp=~P3;
}
while(temp!=0)
{
temp=temp>>1;
no++;
}
return no;
}
void timer0() interrupt 1
{
TH0=0x10;
TL0=0x60;
speak=~speak;
}
void InitTime0()
{
TMOD=0x02;
TH0=0x10;
TL0=0x60;
ET0=1;
TR0=1;
}
void main()
|
评分
-
查看全部评分
|