RSS

Variable LED timing Chaser

20 Jun

‘——————————————————————————-
‘Designer                 : Abhishek kumar
‘name                     : led var time.bas
‘copyright                : (c) 1995-2005, MCS Electronics
‘purpose                  : Variable Time Controlled LED Chaser (Sequential)
‘micro                    : ATMEGA16
‘suited for demo          : yes
‘commercial addon needed  : no
‘use in simulator         : possible
‘eeprom memory usage      : no
‘——————————————————————————-
$regfile = “m16def.dat”
$crystal = 8000000
‘$sim
‘***********************Configure PORTC as output*******************************
Config Portc = Output
‘***************************Variable Declaration********************************
Dim A As Byte
Dim B As Integer
A = 1
‘**************************16X2 LCD Configuration in $ bit mode*****************
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdmode = Port
Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portc.5 , Rs = Portc.4
‘************************Configure external interrupt as low level activation***
Config Int0 = Low Level
Config Int1 = Low Level
‘************************Enabling Interrupts************************************
Enable Interrupts
Enable Int0
Enable Int1
‘*************************Reserving interrupt routine***************************
On Int0 Sh
On Int1 Abhishek
‘*************************Program’s Main Body***********************************

Do
‘_______________Make A=1 if A gets equal to 0, or greater than 10_______________
If A = 0 Or A >= 11 Then
A = 1
End If
‘——————————————————————————-
B = A * 100
‘____________________________LCD Routine (optional)_____________________________
Cls
Lcd “A=” ; A
Lowerline
Lcd “B=” ; B

‘____________________________LED Flashing at port c_____________________________
Portc = &B00000001
Waitms B
Portc = &B00000010
Waitms B
Portc = &B00000100
Waitms B
Portc = &B00001000
Waitms B
‘_______________________________________________________________________________

Loop
End
‘******************* ISR A increment *******************************************
Sh:
If A < 16 Then
Incr A
Waitms 150
End If
Return

‘******************* ISR A decrement *******************************************
Abhishek:
If A > 0 Then
Decr A
Waitms 150
End If
Return
‘*******************************************************************************

Advertisements
 
Leave a comment

Posted by on June 20, 2010 in AVR

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: