Monday, 5 December 2011

EPRLABS: Presenting SIMPLE LED CUBE

http://www.eprlabs.com/2011/10/presenting-simple-led-cube/

Presenting SIMPLE LED CUBE


BLOCK DIAGRAM:
leddcube
Parts Needed:
1.Led
2.Microcontroller
3.Battery

1.Led:
led is used for indication
 
2.Microcontroller:
AT89s52 is to controlling the led
 
3.Battery:
9v,rechargable battery
How it works:
Connecting led in matrix format in microcontroller ports. Glowing each led will give 3d effect which is used for decorative purpose

Circuit Diagram:
code:
org 0x00
loop:
               ;top to bottom
mov r0,#05
l1:
mov p1,#0f7h
mov p2,#0ffh
mov p3,#0ffh
call delaY
mov p1,#0fbh
mov p2,#0ffh
mov p3,#0ffh
call delay
mov p1,#0fdh
mov p2,#0ffh
mov p3,#0ffh
call delay
mov p1,#0feh
mov p2,#0ffh
mov p3,#0ffh
call delay
mov p1,#0fdh
mov p2,#0ffh
mov p3,#0ffh
call delay
mov p1,#0fbh
mov p2,#0ffh
mov p3,#0ffh
call delay
mov p1,#0f7h
mov p2,#0ffh
mov p3,#0ffh
call delay
djnz r0,l1
;left to right
mov r0,05
l2:
mov p1,#00h
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#00h
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#00h
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0f0h
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#00h
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#00h
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#00h
mov p2,#00h
mov p3,#0f0h
call delay
djnz r0,l2
             ; rain flow
mov r0,#07
l4:
mov p1,#0feh
mov p2,#0ffh
mov p3,#0ffh
call delay
  mov p1,#0fdh
mov p2,#06h
mov p3,#00h
  call delay
mov p1,#0fdh
mov p2,#00h
mov p3,#06h
call delay
mov p1,#0fbh
mov p2,#00h
mov p3,#06h
call delay
mov p1,#0fbh
mov p2,#00h
mov p3,#06h
call delay
 mov p1,#0f7h
mov p2,#0ffh
mov p3,#0ffh
call delay
djnz r0,l4
           ;rain flow left to right
mov r0,#07
l6:
mov p1,#00h
mov p2,#00h
mov p3,#0f0h
call delay
  mov p1,#0fdh
mov p2,#06h
mov p3,#00h
  call delay
mov p1,#0fdh
mov p2,#00h
mov p3,#06h
call delay
mov p1,#0f0h
mov p2,#0f0h
mov p3,#00h
call delay
  djnz r0,l6
    ;rocket flying
  mov r0,#5
rocket:
mov r1,#75
loop9: mov r2,#75
loop10:
mov p1,#07h
mov p2,#00h
mov p3,#02h
djnz r2,loop10
djnz r1,loop9
mov r1,#75
loop11: mov r2,#75
loop12:
mov p1,#0bh
mov p2,#00h
mov p3,#02h
djnz r2,loop12
djnz r1,loop11
mov r1,#75
loop13: mov r2,#75
loop14:
mov p1,#0dh
mov p2,#00h
mov p3,#02h
djnz r2,loop14
djnz r1,loop13
mov r1,#75
loop15:
mov r2,#75
loop16:
mov p1,#0eh
mov p2,#00h
mov p3,#02h
djnz r2,loop16
djnz r1,loop15
mov r1,#255
loop6:
mov r2,#255
loop5:
mov p1,#0feh
mov p2,#0ffh
mov p3,#0ffh
djnz r2,loop5
djnz r1,loop6
          ;rocket burst
mov r1,#75
loop17: mov r2,#50
loop18:
mov p1,#0eh
mov p2,#52h
mov p3,#92h
djnz r2,loop18
djnz r1,loop17
mov r1,#75
loop19:
mov r2,#50
loop20:
mov p1,#0eh
mov p2,#0b4h
mov p3,#26h
mov p1,#0dh
mov p2,#52h
mov p3,#0bah
djnz r2,loop20
djnz r1,loop19
call delay
call delay
call delay
djnz r0,led
call led1
led:
call rocket
led1:
 ;snake left to right
mov r4,#5
l02:
mov p1,#0f7h
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#0fbh
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#0fdh
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#0feh
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#0feh
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0fdh
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0fbh
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0f7h
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0f7h
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#0fbh
mov p2,#0h
mov p3,#0fh
call delay
mov p1,#0fdh
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#0feh
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#0feh
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#0fdh
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#0fbh
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#07h
mov p2,#00h
mov p3,#0f0h
call delay
djnz r4,l03
call led2
l03:call l02
 ;snake right to left
led2:
mov r5,#5
l04:
mov p1,#07h
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#0fbh
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#0fdh
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#0feh
mov p2,#00h
mov p3,#0f0h
call delay
mov p1,#0feh
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#0fdh
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#0fbh
mov p2,#0h
mov p3,#0fh
call delay
mov p1,#0f7h
mov p2,#00h
mov p3,#0fh
call delay
mov p1,#0f7h
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0fbh
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0fdh
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0feh
mov p2,#0fh
mov p3,#00h
call delay
mov p1,#0feh
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#0fdh
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#0fbh
mov p2,#0f0h
mov p3,#00h
call delay
mov p1,#0f7h
mov p2,#0f0h
mov p3,#00h
call delay
djnz r5,l05
jmp loop
l05:
call l04
delay:
mov r1,#200
loop1:
mov r2,#150
loop2:
djnz r2,loop2
djnz r1,loop1
ret
end

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