SlideShare a Scribd company logo
INTERFACING LEDS WITH
MICROCONTROLLER
A light-emitting diode (LED) is a PN junction
semiconductor which emits monochromatic(single) light.
When forward-biased (switched on), electron hole
recombination releases energy in the form of photons.
LIGHT EMITTING DIODES
Two configurations of LEDs……..
COMMON CATHODE COMMON ANODE
INTERFACING
DDR X
Data Direction Register
DDR X is used to determine the direction of data on each pin of a given port X
Logic 1 -> specify pin as output port
Logic 0 -> specify pin as input port
Ex- DDRC=0 b 1 1 1 1 1 0 0 0 ;
DDRC=0XF8;
PC0 , PC1 , PC2 -> INPUT PINS
PC3 , PC4 , PC5, PC6 , PC7 -> OUTPUT PINS
DDRB instruction gives the direction of data transfer as each port of atmega
16 is birectional..……
eg:DDRC=0b11110011;
0-- input
1-- output
INSTRUCTIONS USED
PORT X
PORT X is used to determine the data on each pin of a given port.
Ex- PORTC=0 b 1 1 1 1 1 0 0 0 ;
PORT instruction gives data to be sent on the port
eg- PORTC=0b01011011;
1
1
1
1
1
PORT instruction gives data to be sent on the port
eg- PORTC=0b01011011;
INSTRUCTIONS USED
_delay_ms();
It is used to provide a delay of specific time in milliseconds in the program.
Ex- _delay_ms(1000); ->provides delay of 1 second
PROGRAM-
#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRC=0 b 0 0 0 0 1 1 1 1;
//data direction register
for port C//
while( 1 )
{
//infinite loop//
PORTC=0 b 0 0 0 0 1 1 1 1 ; //Data on port C//
_delay_ms(1 0 0 0) ; //Delay of 1 sec//
PORTC=0 b 0 0 0 0 0 0 0 0 ;
_delay_ms(1 0 0 0) ;
}
}
OUTPUT
00:00 sec
OUTPUT
00:01 sec
OUTPUT
00:02 sec
OUTPUT
00:03 sec
Now try and generate the next
pattern on your
own……………………………………….
OUTPUT
00:01 sec
OUTPUT
00:02 sec
OUTPUT
00:03 sec
OUTPUT
00:04 sec
Basic interfacing of LEDs

More Related Content

PPTX
8051 Microcontroller ppt
PPTX
Switches and LEDs interface to the 8051 microcontroller
PDF
8051 interfacing
PPTX
SRAM DRAM
PPT
Memory organization of 8051
PPTX
8251 USART
PPT
PIC 16F877A by PARTHIBAN. S.
PPT
Interfacing LCD with 8051 Microcontroller
8051 Microcontroller ppt
Switches and LEDs interface to the 8051 microcontroller
8051 interfacing
SRAM DRAM
Memory organization of 8051
8251 USART
PIC 16F877A by PARTHIBAN. S.
Interfacing LCD with 8051 Microcontroller

What's hot (20)

PPT
8051 Microcontroller
PDF
8051 Microcontroller I/O ports
PPTX
Serial Communication in 8051
DOCX
ARM7-ARCHITECTURE
PPTX
3.programmable interrupt controller 8259
PPT
Architecture of 8086 Microprocessor
PPT
Adc interfacing
PPTX
Introduction to arduino ppt main
PPT
8051 Addressing Modes
PPT
Master synchronous serial port (mssp)
PDF
Minimum and Maximum Modes of microprocessor 8086
PPTX
PPTX
I/O port programming in 8051
PDF
Pic microcontroller architecture
PPTX
ARM Processors
PPTX
8255 PPI
PPTX
ARM Processor
PPTX
Fpga architectures and applications
PPTX
Architecture of 8051
PDF
DAC Interfacing with 8051.pdf
8051 Microcontroller
8051 Microcontroller I/O ports
Serial Communication in 8051
ARM7-ARCHITECTURE
3.programmable interrupt controller 8259
Architecture of 8086 Microprocessor
Adc interfacing
Introduction to arduino ppt main
8051 Addressing Modes
Master synchronous serial port (mssp)
Minimum and Maximum Modes of microprocessor 8086
I/O port programming in 8051
Pic microcontroller architecture
ARM Processors
8255 PPI
ARM Processor
Fpga architectures and applications
Architecture of 8051
DAC Interfacing with 8051.pdf
Ad

Similar to Basic interfacing of LEDs (20)

PPTX
ATT SMK.pptx
DOCX
Switch level modeling 2 x4
PPTX
decoders121-170714184489769876987698749.pptx
PPTX
Decoders-Digital Electronics
PPTX
B sc cs i bo-de u-iii combitional logic circuit
PPTX
DLD Lecture No 22 Decoder Circuit and Types of Decoder.pptx
PPTX
co-5.pptx mca online ist sem computer organization
PDF
EEE122CombinationalLogicdsddChapter4.pdf
PPT
Digital Logic circuit
PPTX
Microcontroller avr
PPT
amba.ppt
PPT
04_Chapter 4768 - Modular Comb logic.ppt
PPT
Chapter 4 combinational circuit
PPT
11.ppt
PPT
amba DVE Materials for Verification------
PPT
amba (1).ppt
PPT
amba.ppt
PPT
amba.ppt
PPT
Combinational circuit
PPTX
AVR programming - BASICS
ATT SMK.pptx
Switch level modeling 2 x4
decoders121-170714184489769876987698749.pptx
Decoders-Digital Electronics
B sc cs i bo-de u-iii combitional logic circuit
DLD Lecture No 22 Decoder Circuit and Types of Decoder.pptx
co-5.pptx mca online ist sem computer organization
EEE122CombinationalLogicdsddChapter4.pdf
Digital Logic circuit
Microcontroller avr
amba.ppt
04_Chapter 4768 - Modular Comb logic.ppt
Chapter 4 combinational circuit
11.ppt
amba DVE Materials for Verification------
amba (1).ppt
amba.ppt
amba.ppt
Combinational circuit
AVR programming - BASICS
Ad

More from Varad Manglekar (10)

PPTX
Cross Helmet
PPTX
Basic concepts of practical electronics
PPTX
Sensors and Switches
PPTX
PPTX
Line follower robot
PPTX
Introduction to Embedded System
PPTX
Introduction to embedded systems
PPTX
Basic components in Embedded System
PPTX
simple ADC Interfacing
PPT
Controlling Motors for Robot
Cross Helmet
Basic concepts of practical electronics
Sensors and Switches
Line follower robot
Introduction to Embedded System
Introduction to embedded systems
Basic components in Embedded System
simple ADC Interfacing
Controlling Motors for Robot

Recently uploaded (20)

PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Well-logging-methods_new................
PPTX
Geodesy 1.pptx...............................................
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPT
Project quality management in manufacturing
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
UNIT 4 Total Quality Management .pptx
DOCX
573137875-Attendance-Management-System-original
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
Construction Project Organization Group 2.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Well-logging-methods_new................
Geodesy 1.pptx...............................................
CYBER-CRIMES AND SECURITY A guide to understanding
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Embodied AI: Ushering in the Next Era of Intelligent Systems
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Project quality management in manufacturing
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Automation-in-Manufacturing-Chapter-Introduction.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
UNIT 4 Total Quality Management .pptx
573137875-Attendance-Management-System-original
UNIT-1 - COAL BASED THERMAL POWER PLANTS
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Construction Project Organization Group 2.pptx

Basic interfacing of LEDs