Type
仿真图:
代码:
#include"reg52.h"
void delay(unsigned char tim)
{
while(tim--);
}
void main()
{
unsigned char i,temp1=0x01;
unsigned char tab[8]={0xff,0x81,0xe7,0xa5,0xc3,0xbd,0x81,0xff};
//P0=temp;
//P2=0x00;
while(1)
{ temp1=0x01;
for(i=0;i<8;i++)
{
P0=temp1;
P2=~tab[i];
temp1<<=1;
delay(60000);
}
}
}