LED Blinking
Flashing LEDs on PORT A
This section describes how to interface LEDs to the microcontroller ATmega8515 to flash.
LEDs are widely used for simple display functions. Their advantasge is the excellent visibility and low power consumption. Also LEDs can be directly driven from the pins of AVR microcontroller. According to the datasheet of the ATmega8515, the output voltage is 0.6V maximum at a current of 20mA.
In our circuit 8 LEDs are connected to Port A and they are made to blink for every second.
Here's the BASCOM Program from the above circuit.
'-----------------------------------------------------------------------------------------
'copyright : (c) 2008-2009, AVRprojects.info
'purpose : LED Blinking on Port A
'-----------------------------------------------------------------------------------------
$regfile = "m8515.dat" ' specify the used micro
$crystal = 8000000 ' used crystal frequency
Leds Alias Porta 'Define name
Config Porta = Output 'Config Port A as output
Do
Leds = &HFF 'switch off all LEDS
Wait 1 'wait 1 second
Leds = 00 'switch on all LEDs
Wait 1 'wait 1 second
Loop
'unconditional loop
End