Home > Back-end >  Which eldest brother to help explain the program
Which eldest brother to help explain the program

Time:10-20

# include
# define uchar unsigned char
# define uint
Unsigned intsbit a=P1 ^ 2; Sbit b=p ^ 3; Sbit c ^ 4 P1=; P1 sbit d=^ 5;
Uchar highcount;
Uint NUM=5;
Uchar count0, count1, count2, count3;
Void delay ()
{uint I, j; for(i=0; I <256; I++); For (j=0; J <256; J++); }
Void timer0isr (void) interrupt using 1
{TH0=0 xd8;
TL0=0 xf0;
Highcount++;
If (highcount==NUM)
{a=0; Count0=0; }
If (highcount==80)
{b=0; Count1=0; }
If (highcount==150)
{c=0; Count2=0; }
If (highcount==180)
{d=0; Count3=0; }
If (highcount==200)
{a=1; b=1; C=1; D=1;
Count0=1; Count1=1; Count2=1; Count3=1; Highcount=0;
}
}
Void main (void)
{
Highcount=0;
TMOD=0 x01;
a=1; b=1; C=1; D=1;
TH0=0 xd8;
TL0=0 xf0;
EA=1; ET0=1; TR0=1; IT0=1; IT1=1; EX0=1; EX1=1; EA=1; PX1=1;
while(1);
}
Void int0 () using interrupt 0 1
{
NUM +=5;
If (NUM> 95)
NUM=5;
}
  • Related