Sie sind auf Seite 1von 4

opening the railway gate).

Project Detail: Here I use two pressure sensor places in rail line 1 km way from
both side of rail gate. When Rail is coming and touch the first pressure sensor
the motor is start rotating and the gate is attach with motor and it slowly down
and close the door. Before close the door rail traffic light was red and for road
traffic it was green. After closed the gate rail signal is green and road traffic is
red. Now train cross the gate after crossing gate it will touch other pressure
sensor which is situated 1 Km way from other side of crossing. Now motor start
anticlockwise rotating and gate slowly opening and after complete opening of
the gate road traffic light will green and railway signal will red. I used LCD to
display the total status of railway gate control.
I use Proteus to simulate my project and Micro c pro for writing the embedded C
. In bellow found the embedded code which I used.

 
See embedded Code

Embedded C Code
// Name : Automated Railway Gate Controlled

// Purpose : Automated Railway Gate Controlled

// Author : Subham Dutta

// Date : 01-10-13

// Website : www.nbcafe.in

sbit LCD_RS at RD2_bit;


sbit LCD_EN at RD3_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISD3_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;void main() {TRISd=0x00;
TRISC=0b11111111;
trisb=0b00000000;
portb=0b00010100;
lcd_init();
lcd_cmd(_LCD_CURSOR_OFF);
lcd_out(1,1,”Railway Crossing”);
lcd_out(2,1,”nbcafe Gate”);
while(1)
{
if (portc==1){
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,1,”Attantion train”);
lcd_out(2,1,”Near to crossing”);
delay_ms(10);
portb=0b10101001;
delay_ms(10);
portb=0b00001001;
delay_ms(1000);
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,1,”Please Wait”);
lcd_out(2,1,”Gate is Closed”);
}
if (portc==2){
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,1,”Star yor Car”);
lcd_out(2,1,”Gate is Opening”);
delay_ms(10);
portb=0b11000010;
delay_ms(10);
portb=0b00010010;
delay_ms(1000);
portb=0b00010100;
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,1,”Thank you”);
lcd_out(2,1,”Gate is Open”);
}}}

Must See the simulation to understand the project.

Automated Railway Gate Controlled by PIC16F877A

Das könnte Ihnen auch gefallen