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.

Regarding automatically running stepper motor

Status
Not open for further replies.

udayp

Junior Member level 3
Joined
Mar 30, 2011
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,508
I made a project on automatic level crossing + track changing.I am controlling 3 stepper motors using two 89s52 controllers so I kept 3 sensor, one at station and other two for sensing train for gate to close and open respectively. But am facing a problem that when train approach first sensor the gate works fine and it closes but when the train goes to second sensor the gate closes but track changing stepper motor automatically starts and moves the track, actually it should work it should work when the train at station only. I don't know why this is happening. Can any body please help me.

This is my program to open and close gate.

Code:
mov a,#10010000b
here:

l1: jb p1.0,l1         ;gate sensor

clr p2.0          ;siran on
acall longtime:
setb p2.0        ;siran off


mov r0,#90d
loop:
rr a
mov p3,a                ; Gate Close
acall time:
djnz r0 loop


l2: jb p1.1,l2         ;Gate sensor         

mov r1,#90d
loop1:
rl a
mov p3,a                ; Gate open
acall time:
djnz r1 loop1


sjmp here


time:   mov r6,#14d
        mov tmod,#01h
tstart: setb tr0
t2:     jnb tf0,t2
        clr tf0
        clr tr0
ret



longtime:
mov r7,#50d
hre:
acall time:
djnz r7,hre
ret



Program for checking the train at station for track changing.

Code:
mov a,#10010000b

here:

l1: jnb p1.0,l1         ;train sensor

mov r0,#20d
loop:
rr a
mov p3,a                ; Track change
acall time:
djnz r0 loop


l2: jb p1.0,l2         ;train sensor         

mov r1,#30d
loop1:
rl a
mov p3,a                ; track change
acall time:
djnz r1 loop1


sjmp here


time:   mov r6,#14d
        mov tmod,#01h
tstart: setb tr0
t2:     jnb tf0,t2
        clr tf0
        clr tr0
ret
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top