Description of Auto Change Program Lights
Circuit is very
simple and straightforward. control and software denouncing. An ATMEL
Micro-controller AT89C2051 is used to control the LED according to the programs.
There are six programs those change at sequence one by one.
Port 1 is used for LED through a driving IC ULN2804.Port 1 two pins P1.0
and P1.1 are pulled high as they not pulled high internally. A 12 M Hz crystal
is used for basic timings of controller. Micro-controller VCC pin has grounded
by one 0.1 uF capacitor, it should always to be grounded very near to
micro-controller VCC pin to protect by and RFI (Radio Frequency interference).
Schematic Circuit Diagram of the Project
Power Supply
An 9 volts DC supply source can be connected to J2 connector of power
supply.

Software
It is written in BASCOM-51 A Holland company
offering a
Power basic compiler IDE, Many features at
one tool.
Rem Auto Change Flasher Changes five Program
Rem
Every program is run for some time and changes
Rem
to another program
Rem
**** Update
on 25-10-2005
****
Rem
Rem
This module is presented only to serve as an sample for the
Rem
AT89C2051 development. Author provides this module as is and
Rem
does'nt guarantee its functionality or suitability for any
Rem
particulerpurpose
Rem
Pl. E-Mail any question and suggestion to syedpervez@yahoo.com
$crystal = 12000000
Dim O_desgn1 As Byte : O_desgn1 = 1
Dim O_desgn2 As Byte : O_desgn2 = &HF0
Dim O_desgn3 As Byte : O_desgn3 = &H55
Dim O_desgn4 As Byte : O_desgn4 = &H18
Dim O_desgn5 As Byte : O_desgn5 = &H80
Dim Scrol As Byte : Scrol = 0
Dim Count2 As Byte : Count2 = 0
Dim Count3 As Byte : Count3 = 1
Dim Num As Byte : Num = 0
Dim Prog As Byte : Prog = 7
Dim Count As Integer : Count = 900
Dim Repeat As Integer : Repeat = 0
Dim Flag1 As Bit : Reset Flag1
Dim Flag2 As Bit : Reset Flag2
Dim Flag3 As Bit : Reset Flag3
Out_port Alias P1
P1 = 0
Config Timer0 = Timer , Gate = Internal , Mode = 2
Enable Interrupts
Enable Timer0
Load
Timer0 , 250
Start Timer0
On
Timer0 Timer_0_int
Do
Nop
nop
Loop
Timer_0_int:
Incr
Repeat
If
Repeat > Count Then
Repeat
= 0
Gosub
Desgn0
End
If
Return
Desgn0:
Scrol = O_desgn1
Out_port = Scrol
Shift O_desgn1 , Left , 1
If O_desgn1 = 0 Then
O_desgn1 = 1
End If
Return
Desgn1:
Scrol = O_desgn2
Out_port = Scrol
Acc = O_desgn2
!swap acc
O_desgn2 = Acc
Return
Desgn2:
If Flag1 = 0 Then
Scrol = O_desgn1 : Out_port = Scrol
Shift O_desgn1 , Left , 1
If O_desgn1 = 0 Then
O_desgn1 = &H80
Set Flag1
End If
End If
If Flag1 = 1 Then
Scrol = O_desgn1 : Out_port = Scrol
Shift O_desgn1 , Right , 1
If O_desgn1 = 0 Then
O_desgn1 = 1
Reset Flag1
End If
End If
Return
Desgn3:
If
Flag2 = 0 Then
Scrol = O_desgn3 : Out_port = Scrol
Rotate , O_desgn3 , Right , 1
Set Flag2
Goto Skip1
End If
If Flag2 = 1 Then
Scrol = O_desgn3 : Out_port = Scrol
Rotate , O_desgn3 , Left , 1
Reset Flag2
End If
Skip1:
Return
Desgn4:
If Count2 = 0 Then
Scrol = O_desgn4 : Out_port = Scrol
Count2 = Count2 + 1
Goto Skip2
End If
If Count2 = 1 Then
Scrol = &B00100100 : Out_port = Scrol
Count2 = Count2 + 1
Goto Skip2
End If
If Count2 = 2 Then
Scrol = &B01000010 : Out_port = Scrol
Count2 = Count2 + 1
Goto Skip2
End If
If
Count2 = 3 Then
Scrol = &B10000001 : Out_port = Scrol
Count2 = Count2 + 1
Goto Skip2
End If
If
Count2 = 4 Then
Scrol = &B01000010 : Out_port = Scrol
Count2 = Count2 + 1
Goto Skip2
End If
If Count2 = 5 Then
Scrol = &B00100100 : Out_port = Scrol
Count2 = 0
Goto Skip2
End If
Skip2:
Return
Desgn5:
Scrol = O_desgn5 : Out_port = Scrol
Rotate O_desgn5 , Right , 1
O_desgn5 = O_desgn5 Or &H80
If Flag3 = 1 Then
O_desgn5 = 0
Reset Flag3
Goto Skip4
End If
If O_desgn5 = &HFF Then : Set Flag3
End If
Skip4:
Return
Desgn6:
If
Count3 > 0 And Count3 < 25 Then
Gosub Desgn0
Count3 = Count3 + 1
Goto Skip3
End If
If Count3 > 24 And Count3 < 35 Then
Gosub Desgn1
Count3 = Count3 + 1
Goto Skip3
End If
If Count3 > 34 And Count3 < 82 Then
Gosub Desgn2
Count3 = Count3 + 1
Goto Skip3
End If
If Count3 > 81 And Count3 < 92 Then
Gosub Desgn3
Count3 = Count3 + 1
Goto Skip3
End If
If Count3 >
91 And Count3 < 112 Then
Gosub Desgn4
Count3 = Count3 + 1
Goto Skip3
End If
If Count3 >
111 And Count3 < 135 Then
Gosub Desgn5
Count3 = Count3 + 1
Goto Skip3
End If
If Count3 = 135 Then
Count3 = 1
Goto Skip3
End If
Skip3:
Return