Thursday, 4 August 2011

TRAFFIC LIGHT INTERFACING WITH AT89C51 MICROCONTROLLER


Hi every one this video is demo of traffic light interfacin..you can also find its program and circuit diagram.




org 0300h
db 10h,00h,78h,02h,12h,19h,30h,24h,79h,40h
org 0000h
again:mov p3,#24h
mov p1,#09h
acall ldelay
mov p3,#12h
mov p1,#12h
acall sdelay
mov p3,#09h
mov p1,#24h
acall ldelay
mov p3,#12h
mov p1,#12h
acall sdelay
sjmp again
ldelay: mov r4,#06h
mov dptr,#0300h
mov a,r4
movc a,@a+dptr
mov p0,a
mov a,#40h
mov p2,a
acall delay
inc r4
nxt: mov dptr, #0300h
mov a,r4
movc a,@a+dptr
mov p0,a
mov r3,#0ah
mov dptr, #0300h
next: clr a
movc a,@a+dptr
mov p2,a
acall delay
inc dptr
djnz r3,next
inc r4
cjne r4,#0ah,nxt
 ret
delay:mov r1,#20
mov TMOD,#01h
here:mov TL0,#25h
mov TH0,#4Ch
setb TR0
here1:jnb TF0,here1
clr TR0
clr TF0
djnz r1, here
ret
sdelay:mov p0,#00h
mov p2,#00h
mov a,#00h
mov p0,#40h
mov dptr,#0300h
mov r5,#04h
z:mov a,r5
movc a,@a+dptr
mov p2,a
acall delay2
inc r5
cjne r5,#0ah,z
sjmp out
delay2:mov r1,#20
mov TMOD,#01h
here2:mov TL0,#25h
mov TH0,#4Ch
setb TR0
here4:jnb TF0,here4
clr TR0
clr TF0
djnz r1, here2
out:
ret
end



THANK YOU VERY MUCH....
GOOD LUCK..

6 comments: