SlideShare a Scribd company logo
#include <reg51.h>
#include"lcddisplay.h"
sbitstatusred = P3^0;
sbitstatusgreen = P3^1;
sbitlight = P3^2;
sbitlightsw = P3^6;
sbitstart_sw = P3^3;
sbitback = P3^4;
sbithorn = P3^5;
sbitalert = P3^7;
sbitbuz = P2^7;
/** l293d connectionc***/
/** l293d connectionc***/
sbitin1 = P2^2;
sbitin2 = P2^3;
sbitin3 = P2^4;
sbitin4 = P2^5;
sbiten1 = P2^0;
sbiten2 = P2^1;
unsignedchari,lightstatus=0;
voidmain()
{
unsignedintTIME,x,yy;
lcd_init();
lcd_init();
in1=0;
in2=0;
lcdcmd(0x84);
msgdisplay("WELCOME");
delay(2000);
statusred=1;
statusgreen=0;
delay(1000);
start:
lcdcmd(0x01);
msgdisplay("INTILLEGENT");
lcdcmd(0xC0);
msgdisplay("TRAIN ENGINE");
while(start_sw==1); //waittill trainstarted
en1=1;
en2=1;
in1=1;
in2=0;
in3=1;
in4=0;
lcd_init();
lcd_init();
xy:
lcdcmd(0x01);
msgdisplay("TRAIN STARTED");
lcdcmd(0xc0);
msgdisplay("CHECKNGRESPONSE");
for(TIME=0;TIME<3000;TIME++)
{
xx:
if(start_sw==0)
{
statusred=1;
statusgreen=0;
en1=en2=0;
in1=0;
in3=0;
in2=0;
in4=0;
lcdcmd(0x01);
msgdisplay("TRAIN STOPPED");
delay(100);
while(start_sw==0);
goto start;
}
if(horn==0)
{
buz=0;
lcdcmd(0x01);
msgdisplay("HORN OPERATED");
delay(1000);
while(horn==0);
buz=1;
TIME=0;
}
if(lightsw==0)
{
lightstatus=~lightstatus;
lcdcmd(0x01);
if(lightstatus)
{
light=0;
msgdisplay("LIGHTISON!!");
}
else
{
msgdisplay("LIGHTISOFF!!");
light=1;
}
delay(1000);
while(lightsw==0);
TIME=0;
}
if(back==0)
{
en1=en2=0;
in1=0;
in3=0;
in2=1;
in4=1;
delay(50);
en1=en2=1;
lcd_init();
lcdcmd(0x01);
msgdisplay(" TRAIN IS ");
lcdcmd(0xC0);
msgdisplay("MOVINGBACK...");
delay(1000);
while(back==0);
TIME=0;
}
delay(5);
}
TIME=0;
lcdcmd(0x01);
msgdisplay("ALERTTIME...");
buz=0;
for(x=0;x<800;x++)
{
lcdcmd(0xc0);
convert(x);
delay(1);
if(alert==0)
{
for(yy=0;yy<600;yy++)
{
if(alert==1)
goto xx;
}
buz=1;
TIME=0;
goto xy;
}
/*proceed:
if((signalred==0)&&(signalgreen==1))
goto xx;**/
}
en1=0;
en2=0;
in1=in3=0;
in2=0;
in4=0;
lcdcmd(0x01);
msgdisplay("TRAIN STOPPED..");
statusred=0;
statusgreen=1;
buz=0;
while(1);
}

More Related Content

DOCX
TXT
ติดที่ละเลเยอร์
DOCX
Caculadora pacho (1)
DOCX
contoh program avr
PPTX
Membuat traffic light dengan avr at mega
PDF
Programming in C
PPTX
Practico Nº 2
DOCX
Programasluis
ติดที่ละเลเยอร์
Caculadora pacho (1)
contoh program avr
Membuat traffic light dengan avr at mega
Programming in C
Practico Nº 2
Programasluis

Viewers also liked (15)

PDF
DOCX
Cc 2125 pecados contra el primer mandamiento ! ateismo II !
DOCX
úLtima presentación documento word
DOC
Historia de chancay banos
PPTX
PDF
Alimentos com poder de cura
PPTX
Sucesión testamentaria y clasificación de los testamentos
PPS
El anillo
PDF
Reederei Albrecht
DOCX
CHRISMALYN VILLA (RESUME & CURRICULUM GRADES)
PDF
Analisis estructural hibbeler
PPT
творчий звіт
PPTX
Resumen del Informe del WGII
PPTX
Presentacion cultura politica
Cc 2125 pecados contra el primer mandamiento ! ateismo II !
úLtima presentación documento word
Historia de chancay banos
Alimentos com poder de cura
Sucesión testamentaria y clasificación de los testamentos
El anillo
Reederei Albrecht
CHRISMALYN VILLA (RESUME & CURRICULUM GRADES)
Analisis estructural hibbeler
творчий звіт
Resumen del Informe del WGII
Presentacion cultura politica
Ad

Intelligentengine