Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

project:automatic gate control and track switching in railways

Status
Not open for further replies.

anika_ch

Newbie level 3
Joined
Oct 2, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
i am working on a project "automatic gate control and track switching in railways".i m facing problems in doing the track switching part.i am not sure about wic hardware should be used to switch the track??????.i m using a toy train in dis project n m using 8051..if i want to stop the train den do i need to design a model train????n in that case do i need to use pwm????
i have used d following code to stop d train..but i m uncertain about the condition wic i shud give in the interrupt call....
plzz help me...
#include <reg51.h>
sbit PWMPIN=P1^0;
sbit SW =P1^7;
sbit IND =P1^3;
sbit my = P1^6;

unsigned char pwm_width;

void timer0() interrupt 1 {
if(my==1) { //Start of High level
my = 0; //Set flag
PWMPIN = 0; //Set PWM o/p pin
pwm_width =0x10 ;
TH0 = pwm_width; //Load timer
TF0 = 0; //Clear interrupt flag
return; //Return
}
else { //Start of Low level
my = 1; //Clear flag
PWMPIN = 0; //Clear PWM o/p pin
TH0 = 255 - pwm_width; //Load timer
TF0 = 0; //Clear Interrupt flag
return; //return
}
}

int main()
{

TMOD = 0x00;

EA = 1;
ET0 = 1;
TR0 = 1;
IE=0x82;
while(1)
{
SW=IND; }
return 0;
}

MOD: Using SMS language is not allowed in this forum. Next time you will get a warning.
 
Last edited by a moderator:

if you use pwm it would be easier, you can slow down the rate. That is you can have the control of the speed for the train that is moving :)

---------- Post added at 16:47 ---------- Previous post was at 16:45 ----------

you can use the toy train then, use the pwm to control the supply to the tracks. That might do the trick :)
 

thnx 4 replyg...
wat if instead of slowing down using pwm..i stop the motor wen i detect any signal???

---------- Post added at 18:00 ---------- Previous post was at 17:58 ----------

@abv:i dint get u...u mean i shud used pwm to control the supply to tracks or motor??
 

Can also. But slowing down using pwm for the train to travel at specific rate gives more accurate system modelling right? :)

---------- Post added at 17:02 ---------- Previous post was at 17:00 ----------

Depending on the model train you use, some has the supply on the track, some supply to the motor directly. :)
 

yea..u right..i have yet not decided which model train i shud use??can u suggest me wid something??
 

wat if instead of slowing down using pwm..i stop the motor wen i detect any signal???
If you can do it that would be an excellent idea.
Regards,
Jerin.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top