AVR LED Blinking

In this tutorial we are going to play with LEDs or rather we are going to blink them. This tutorial will give you basic insight into AVR microcontroller programming. Most of us are fascinated by blinking LEDs. Let's do it!

In this tutorial we will be using Atmega32 microcontroller but you can use this for other 8-bit AVR micocontrollers having same instruction set as Atmega32 as well.

Objective:- To blink 8 LEDs connected to PORTA of Atmega32 microcontroller.

C Code


#include #include int main() { DDRA = 0xFF; //Port A is being used for output so we need to make it high while(1) { PORTA=0; _delay_ms(50); PORTA=255; _delay_ms(50); } return (1); }