lần lượt ạ. anh coi dùme em đoạn code này có j sai mà em biên dịch không có dc. cái này là em tự viết
// Khai bao thu vien
#include <REGX51.H>
// Ham Delay
void delay(int time)
{
while(time--)
{
int temp = 121;
while(temp--);
}
//Bat dau than chuong trinh luon nay
void main ()
{
while (1) // gia tri 1 là luon dung nen vong lap la vo tan cho den khi mat dien
{
P2=0x01;
delay(50);
P2=0x02;
delay(50);
P2=0x04;
delay(50);
P2=0x08;
delay(50);
P2=0x10;
delay(50);
P2=0x20;
delay(50);
P2=0x40;
delay(50);
P2=0x80;
delay(50);
}
}// Khai bao thu vien
#include <REGX51.H>
// Ham Delay
void delay(int time)
{
while(time--)
{
int temp = 121;
while(temp--);
}
//Bat dau than chuong trinh luon nay
void main ()
{
while (1) // gia tri 1 là luon dung nen vong lap la vo tan cho den khi mat dien
{
P2=0x01;
delay(50);
P2=0x02;
delay(50);
P2=0x04;
delay(50);
P2=0x08;
delay(50);
P2=0x10;
delay(50);
P2=0x20;
delay(50);
P2=0x40;
delay(50);
P2=0x80;
delay(50);
}
}
#include <REGX51.H>
// Ham Delay
void delay(int time)
{
while(time--)
{
int temp = 121;
while(temp--);
}
//Bat dau than chuong trinh luon nay
void main ()
{
while (1) // gia tri 1 là luon dung nen vong lap la vo tan cho den khi mat dien
{
P2=0x01;
delay(50);
P2=0x02;
delay(50);
P2=0x04;
delay(50);
P2=0x08;
delay(50);
P2=0x10;
delay(50);
P2=0x20;
delay(50);
P2=0x40;
delay(50);
P2=0x80;
delay(50);
}
}// Khai bao thu vien
#include <REGX51.H>
// Ham Delay
void delay(int time)
{
while(time--)
{
int temp = 121;
while(temp--);
}
//Bat dau than chuong trinh luon nay
void main ()
{
while (1) // gia tri 1 là luon dung nen vong lap la vo tan cho den khi mat dien
{
P2=0x01;
delay(50);
P2=0x02;
delay(50);
P2=0x04;
delay(50);
P2=0x08;
delay(50);
P2=0x10;
delay(50);
P2=0x20;
delay(50);
P2=0x40;
delay(50);
P2=0x80;
delay(50);
}
}
Comment