How to Interface LEDs with AVR Slicker

Interfacing led with AVR Slilcker

Tags: Interfacing LED with AVR, Circuit Diagram to Interface LED with AVR, C Program to switch ON and OFF LED using AVR,blink led using AVR,Testing the LED with AVR,
Overall rating
AVR Slicker Board

The AVR Slicker board is specifically designed to help students to master the required skills in the area of embedded systems. The kit is designed in such way that all the possible features of the microcontroller will be easily used by the students. The kit supports In-system programming (ISP) which is done through Parallel/Printer port.

ATMEL’s AVR (Atmega8535), AVR Slicker Kit is proposed to smooth the progress of developing and debugging of various designs encompassing of High speed 8-bit Microcontrollers.

LED (Light Emitting Diodes)

Light Emitting Diodes (LED) is the most commonly used components, usually for displaying pins digital states. Typical uses of LEDs include alarm devices, timers and confirmation of user input such as a mouse click or keystroke.

Interfacing LED

Fig. 1 shows how to interface the LED to microcontroller. As you can see the Anode is connected through a resistor to GND & the Cathode is connected to the Microcontroller pin. So when the Port Pin is HIGH the LED is OFF & when the Port Pin is LOW the LED is turned ON.


Fig. 1 Interfacing LED to Microcontroller

Interfacing LED with AVR

We now want to flash a LED in AVR Slicker Board. It works by turning ON a LED & then turning it OFF & then looping back to START. However the operating speed of microcontroller is very high so the flashing frequency will also be very fast to be detected by human eye.

The AVR Slicker board has eight numbers of point LEDs, connected with I/O Port lines (PORTx.0 – PORTx.7) to make port pins high.

Pin Assignment with AVR


Point LEDs


LED Selection








Connect Any one PORT from


with JP13 (LED Section) via FRC
















Output:  LED’s will be Turned ON and OFF at 500ms interval.


Circuit Diagram to Interface LED with AVR


Source Code

The Interfacing LED with AVR program is very simple and straight forward, that uses a delay procedure loop based software delay. In C programs you cannot be sure of delay, because it depends on compiler how it optimizes the loops as soon as you make changes in the options the delay changes.

C Program to switch ON and OFF LED using AVR Slicker


Title : Program to Blink LEDs



#include <mega8535.h>

#include <DELAY.h>


void main()


      DDRB = 0xFF;            //PORTB input

      PORTB= 0x00;         

      DDRA = 0xFF;            //PORTA output

      PORTA= 0x00;


  DDRC = 0xFF;            //PORTB input

      PORTC= 0x00;         

      DDRD = 0xFF;            //PORTA output

      PORTD= 0x00;




                        PORTA=0xff;                // LEDs turned  on




                delay_ms(500);       // LEDs turned OFF










To compile the above C code you need the CodeVision AVR software. The software has it’s own IDE and built-in AVR gcc- Compiler. They must be properly installed and a project with correct settings must be created in order to compile the code. To compile the above code, the C file must be added to the project.

In CodeVision AVR software, you can develop or debug the project without any hardware setup. You must compile the code for generating HEX file. In debugging Mode, you want to check the port output without microcontroller Board.

The AVR Code Blaster software is used to download the hex file into your microcontroller through Parallel port.

Testing the LED with AVR Slicker

Give +12V power supply to AVR Slicker Board; the LED is connected with AVR Slicker Board. When the program is downloading into AVR in Slicker Board, the LED output is working that the LED is ON some time period and the LED is OFF some other time period.

If you are not reading any output from LED, then you just check the jumper connections & check the LED is working. Otherwise you just check it with debugging mode in CodeVision AVR.

General Information

  • For proper working use the components of exact values as shown in Circuit file.
  • Solder everything in a clean way. A major problem arises due to improper soldering, solder jumps and loose joints.
  • Use the exact value crystal shown in schematic.
  • More instructions are available in following articles,
       -  User Manual of AVR Slicker Board.
       -  How to create & Debug a Project in CodeVision AVR.

Join the World's Largest Technical Community

we respect your privacy.