Đây là chương trình của em:
#include "regx51.h"
unsigned char led[ ] = { 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 } ;
void delay(unsigned char time)
{
while(time--)
{
unsigned char j=125;
while(j--);
};
}
void main()
{
unsigned char i;
while(1)
{
for ( i=0;i<8;i++)
{
P1 = led[i];
delay(2000);
}
};
}
em viet bang Kail C
#include "regx51.h"
unsigned char led[ ] = { 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 } ;
void delay(unsigned char time)
{
while(time--)
{
unsigned char j=125;
while(j--);
};
}
void main()
{
unsigned char i;
while(1)
{
for ( i=0;i<8;i++)
{
P1 = led[i];
delay(2000);
}
};
}
em viet bang Kail C
Comment