#include<reg52.h>
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;
sbit ENLED = P1^4;
void main()
{
unsigned int i,j;
ENLED=0;
ADDR3=1;
ADDR2=1;
ADDR1=1;
ADDR0=0;
while(1)
{
for(j=0;j<1000;j+=5)
{
P0=0x00;
for(i=0;i<1000-j;i++);
P0=0xFF;
for(i=0;i<j;i++);
}
for(j=0;j<1000;j+=5)
{
P0=0xff;
for(i=0;i<1000-j;i++);
P0=0x00;
for(i=0;i<j;i++);
}
}
}
|