#include <regx51.h>
#define led P2
#define XUNG P3_7 //LAY XUNG TU 555
#define bam P1_5
unsigned char dich;
///////
void delay()
{
while(XUNG==1)
{
}
while(XUNG==0)
{
}
}
//////
void mau()
{
while(1)
{
led=0x01;
for(dich=0;dich<7;dich++)
{
led<<=1;
delay();
}
}
}
main()
{
while(1)
{
{
if(bam=1)
{
mau();
delay();
}
else
{
led=0xff;
led=0x00;
led=0xff;
led=0x00;
led=0xff;
led=0x00;
delay();
}
}
}
}
#define led P2
#define XUNG P3_7 //LAY XUNG TU 555
#define bam P1_5
unsigned char dich;
///////
void delay()
{
while(XUNG==1)
{
}
while(XUNG==0)
{
}
}
//////
void mau()
{
while(1)
{
led=0x01;
for(dich=0;dich<7;dich++)
{
led<<=1;
delay();
}
}
}
main()
{
while(1)
{
{
if(bam=1)
{
mau();
delay();
}
else
{
led=0xff;
led=0x00;
led=0xff;
led=0x00;
led=0xff;
led=0x00;
delay();
}
}
}
}
Comment