Sao mình code như vầy thì trên Protues nó chạy đến khi thử testboard thì nó ko chớp tắt.
#include <regx52.h>
#include <stdio.h>
//************************************************** ********************************
//Tao ham thoi gian tre de duy tri thoi gian sang cho led;
void delay(unsigned int ms) //ms co 1000 nen khia bao kieu int
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<121;j++)
{}//Khong lam gi ca
}
void hieu_ung_1()//chop tat
{
P0=P1=P2=P3=0x00;delay(500);
P0=P1=P2=P3=0xFF;delay(500);
}
main()
{
while(1)
{
hieu_ung_1();
}
}
#include <regx52.h>
#include <stdio.h>
//************************************************** ********************************
//Tao ham thoi gian tre de duy tri thoi gian sang cho led;
void delay(unsigned int ms) //ms co 1000 nen khia bao kieu int
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<121;j++)
{}//Khong lam gi ca
}
void hieu_ung_1()//chop tat
{
P0=P1=P2=P3=0x00;delay(500);
P0=P1=P2=P3=0xFF;delay(500);
}
main()
{
while(1)
{
hieu_ung_1();
}
}
Comment