,

Interfacing of Led using ATMEGA16

Overview

In this tutorial we will learn about following below things:-

  • What is Led?
  • How does it work?
  • Interfacing of Led using Atmega16 microcontroller
  • Connection of Led using Atmega16 microcontroller using Proteus Design
  • Programming in C language

Led has number of applications ,it form alpha numeric numbers on digital clocks & led display, transmit information from remote controls to device, light up digital watches & tell you when your appliances are turned on or not. Combined together, they can form images on a LED television screen or illuminate a traffic light. Led are most widely used means of taking output from devices. Led is very economical and easily available in electronics shops & market with variety of shape, size and colors according to requirements of user.

leds

Explanation

As we know that Led is stand for light emitting diode which emitted light only forward biased i,e. When we applied a voltage source across the terminals of led, means +ve terminal of source to anode of led & -ve to cathode then electron & holes recombine & reaches the higher energy state and higher energy state is unstable so that it release the energy in form of light (photons). This process is called electroluminescence.

Out of two terminals for Led, Longer one is anode & shorter one cathode as shown below.

led terminals

Logic to Glow Led

To glow a LED we give a logic one (+ve) to the anode and we put ground means logic zero (-ve) to the cathode. We thing should be noted that we need to connect one resistance between led & our microcontroller to prevent it from damage because as we know led operate at 2v & 10 mA but microcontroller output is 5v so place resistance for better life of led & damage proof.

LED LOGIC

Here for Interfacing of Led using Atmega16 we are using ATMEGA16 AVR Mega series microcontroller for controlling the led or we can say this to take an output. It is Advance Harvard Architecture and is a 8-bit microcontroller with 16K Flash memory and 512 Bytes of EEPROM, 1K SRAM and uses 1 MHz Crystal Oscillator for clock generation, which provides a 1MIPS and it has in build 1-16MHz oscillator and which can provide speed up to 16MIPS.

atmega16

It has 32 input/output port out of 40 pin architecture, CPU, and peripheral in a single chip. Reason for using an AVR microcontroller is that it uses low power, and is application specific, and AVR stands for advance virtual RISC (Reduced Instruction Set Computer) machine.

AVR uses pipelining concept for data, address fetching as well as execution. The Atmega16 is based on CMOS technology for low heat dissipation

Circuit Design

Proteus Design of interfacing of led using Atmega16.

We have connected LED with pin PD0 and we will get the blinking of LED because we have given the logic 1 to the pin PD0. After 1 second LED turns off because we have given logic 0 to the pin PD0 after the delay function as one can see in the programming portion.

Led circuit Design

C Code

C Programming of interfacing of Led using Atmega16

********************************************************************************
http://www.embeddinator.com/

This program is developed by EMBEDDINATOR DEVELOPERS.
********************************************************************************

#include<avr/io.h>               // header file for avr input-output operations

#include<util/delay.h>        // header file for the delay function

void main()                           // program main body

{

DDRD= 0b11111111;          // enable port D as output port

while(1)                               // infinite loop

{

PORTD= 0b00000001;            // passing pin PD0 as logic 1 to glow LED

_delay_ms(1000);                    // delay of 1000 ms.(i.e. 1 second)

PORTD= 0b00000000;       // passing pin PD0 as logic 0 now to off LED

_delay_ms(1000);                // again passing delay of 1 second

}      }

*******************************************************************************
End program

Thank you for visiting our website

http://www.embeddinator.com/
*******************************************************************************