tôi có chương trình nhà dể xe tự động làm đồ án tốt nghiệp mong các bạn vẽ thuạt toán dùm, cảm ơn các bạn
#include<regx52.h>
#include<stdio.h>
#include<math.h>
sbit led1 = P0^3;
sbit led2 = P0^2;
sbit led3 = P0^1;
sbit led4 = P0^0;
sbit led5 = P1^7;
sbit led6 = P1^5;
sbit cb1 = P3^0;
sbit cb2 = P3^1;
sbit cb3 = P3^2;
sbit cb4 = P3^3;
sbit cb5 = P3^4;
sbit cb6 = P3^5;
sbit cb7 = P3^6;
sbit cb8 = P3^7;
sbit dc1 = P1^0;
sbit dao1 = P1^1;
sbit dc2 = P1^2;
sbit dao2 = P1^3;
sbit ct1 = P0^4;
sbit ct2 = P0^5;
sbit ct3 = P0^6;
sbit ct4 = P0^7;
const unsigned char maled[10]={0x40,0xf9,0x24,0x30,0x19,0x12,0x02,0xf8,0x00,0x10};
void delay (int t)
{int i,j;
for(i=0;i<=t;i++){
for(j=0;j<200;j++)
{};
};
}
void main()
{long x1=0,x2=0;
int i,soxe=0;
bit b1=0,b2=0,b3=0,b4=0,b5=0,b6=0,b7=0,b8=0,b9=0,c1=0,c2=0,b10=0,b11=0,b12=0,kt=0;
led1=0;led2=0;led3=0;led4=0;led5=0;led6=0;
dc1=0;dc2=0;dao1=0;dao2=0;
dc1=0;
while(1){
P2=maled[soxe];
//kiem tra so xe///////////////////
if(cb1==1)
{if(b1==0){b1=1;soxe++;led1=1;}
}
else
{if(b1==1){b1=0;soxe--;led1=0;}}
if(cb2==1)
{if(b2==0){b2=1;soxe++;led2=1;}
}
else
{if(b2==1){b2=0;soxe--;led2=0;}}
if(cb3==1)
{if(b3==0){b3=1;soxe++;led3=1;}
}
else
{if(b3==1){b3=0;soxe--;led3=0;}}
if(cb4==1)
{if(b4==0){b4=1;soxe++;led4=1;}
}
else
{if(b4==1){b4=0;soxe--;led4=0;}}
///////////////////////////////////
//kiem tra co xe vo xe ra/////////
if(kt==0)
{
if(cb5==1)
{if(b5==0){b5=1;dc1=1;dao1=0;}
}
else b5=0;
if(cb6==1)
{if(b6==0){b6=1;dc1=1;dao1=1;c1=1;x1=0;}
}
else b6=0;
if(cb7==1)
{if(b7==0){b7=1;dc2=1;dao2=0;c1=1;x1=0;}
}
else b7=0;
if(cb8==1)
{if(b8==0){b8=1;dc2=1;dao2=1;c2=1;x2=0;}
}
else b8=0;
}
if(ct1==0){if(b9==0){dc1=0;b9=1;}}
else b9=0;
if(ct2==0){if(b10==0){dc1=0;b10=1;}}
else b10=0;
if(ct3==0){if(b11==0){dc2=0;b11=1;}}
else b11=0;
if(ct4==0){if(b12==0){dc2=0;b12=1;}}
else b12=0;
if(soxe>3)
{led6=1;kt=1;}
else {led6=0;kt=0;}
////////////////////////////////////////
///////////////////////////////////////
}
}