#include <at89x51.h>
unsigned int i, j, k, start;
void
init_int()
{
TMOD = 0x00;
TCON = 0x11;
IE = 0x83;
TH0 =
0xe3;
TL0 = 0x07;
start = 0;
k = 0;
}
void main()
{
TR0
= 1;
init_int();
while(1)
{
}
}
void ex0_isr() interrupt
0
{
for(i=0;i<50000;i++);
start = 1;
}
void t0_isr() interrupt 1
{
TH0 = 0xe3;
TL0 = 0x07;
j =
P1;
j&=0x07;
if(start==1)
{
k++;
if(k<10)
{
if((P1&0x07)==0x05) P2=0x35;
else if((P1&0x07)==0x04)
P2=0x37;
else if((P1&0x07)==0x06) P2=0x36;
else
if((P1&0x07)==0x01) P2=0x3d;
else if((P1&0x07)==0x03)
P2=0x35;
else if((P1&0x07)==0x07) P2=0x3a;
}
else
if((k>=10)&&(k<35))
{
P2=0x3f;
}
else
if(k>=35) k=0;
}
}
위 소스에 어디 부분을 수정해야 동작을 잘 할 수 있을가요........................