程序附录:
#include sbit P2_0=P2^0;sbit P2_1=P2^1;sbit P2_2=P2^2;
void delaytime(int count);void main(void)
{ while(1)
{ P2_2=0;P2_1=0;P2_0=0;delaytime(500);P2_2=0;P2_1=0;P2_0=1;delaytime(500);P2_2=0;P2_1=1;P2_0=0;delaytime(500);P2_2=0;P2_1=1;P2_0=1;delaytime(500);P2_2=1;P2_1=0;P2_0=0;delaytime(500);P2_2=1;P2_1=0;P2_0=1;delaytime(500);P2_2=1;P2_1=1;P2_0=0;delaytime(500);P2_2=1;P2_1=1;P2_0=1;delaytime(500);
}
void delaytime(int count)
{
int j,k;
while(count-- !=0)
{
for(j=0;j<10;j++)
for(k=0;k<72;k++)
;
}
}