Monday, 5 December 2011

4 Way Traffic Light Controller using Microcontroller


BLOCK DIAGRAM:
4way traffic light
PARTS Needed:
1.MICROCONTROLLER
2.RESISTOR
3.LED
4.BATTERY
1.MICROCONTROLLER:
AT89S52 IS A CONTROLLER WHICH IS USED TO CONTROLL THE LED
AT89s52
2.RESISTOR:
330OHM RESISTOR IS USED TO RESIST THE SUPPLY WHICH WE HAVE GIVEN
resistor
3.LED:
led is to visit the output
led
4.BATTERY:
9v, RECHARGABLE BATTERY
battery
HOW  IT  WORKS:
Microcontroller turns the port on and off with which we connect the LEDs.
Key thing is how the expected time delay is achieved.
CIRCUITDIAGRAM:
CODE:
 org 0x00
 loop:
   mov p2,#0f1h
   clr p1.0
   call delay
   setb p1.0
   call delay
   mov p2,#0e1h
   call delay

   mov p2,#0f2h
   clr p1.1
   call delay
   setb p1.1
   call delay
   mov p2,#0d2h
   call delay
   mov p2,#0f4h
   clr p1.2
   call delay
   setb p1.2
   call delay
   mov p2,#0b4h
   call delay
 mov p2,#0f8h
   clr p1.3
   call delay
   setb p1.3
   call delay
   mov p2,#78h
   call delay

   jmp loop
 delay:
   mov r1,#2
 l1:
   mov r2,#212
 l2:
   mov r3,#255
 l3:
   mov r4,#255
 l4:
   djnz r4,l4
   djnz r3,l3
   djnz r2,l2
   djnz r1,l1
   ret
   end
HEX CODE:
:1000000075A0F1C29012004FD29012004F75A0E17E
:1000100012004F75A0F2C29112004FD29112004F00
:1000200075A0D212004F75A0F4C29212004FD29266
:1000300012004F75A0B412004F75A0F8C2931200C1
:010040004F70
:10004100D29312004F75A07812004F02000079027E
:0F0051007AD47BFF7CFFDCFEDBFADAF6D9F222F1
:00000001FF


No comments:

Post a Comment