0% found this document useful (0 votes)
13 views14 pages

Diwali LED Patterns with 8051 Microcontroller

Uploaded by

pramitnandi.hit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views14 pages

Diwali LED Patterns with 8051 Microcontroller

Uploaded by

pramitnandi.hit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EXPERIMENT – 2

Title of the Experiment :-

Implementation of Diwali Decorative Lighting Using 8051 Microcontroller with Sequential &
Pair-LED Patterns

Objective :-

1. To connect four different coloured LEDs (Red, Green, Blue, Yellow) with the 8051
microcontroller.

2. To generate two lighting sequences using assembly language:

o Pattern-1: R → G → B → Y
o Pattern-2: YR → RG → GB → BY

3. To simulate the design using Proteus and verify proper LED operation.

Components Required :-

Sl. No Component Specification Quantity

1 Microcontroller 8051 / AT89C51 / 80C31 1

2 LEDs Red, Green, Blue, Yellow 4

3 Resistors 220 Ω 4

4 Crystal Oscillator 12 MHz 1

5 Capacitors 33 pF 2

6 Connecting Wires – As required

7 Simulation Software Proteus 8 –

1
Circuit Diagram (Proteus):-

i. R – G – B – Y Connection :-

ii. YR-RG-GB-BY Connection :-

2
Circuit Connections :-

The LEDs are connected to Port-1 of the microcontroller as follows:

LED Colour 8051 Pin

Red (R) P1.0

Green (G) P1.1

Blue (B) P1.2

Yellow (Y) P1.3

and again another:

LED Colour 8051 Pin

Red (R) P1.5

Green (G) P1.6

Blue (B) P1.7

Yellow (Y) P1.4

Note: LEDs are active-LOW (0 = ON, 1 = OFF).

Theory :-

LED interfacing with 8051 is commonly performed using any of the four available 8-bit ports
(P0, P1, P2, P3).
Port-1 is a quasi-bidirectional I/O port with internal pull-ups, making it ideal for LED
interfacing.
When an LED is connected between a port pin and GND with a series resistor, the LED glows
when the port pin outputs logic 0.
Sequential lighting patterns are generated by changing the port output logic in assembly
language, controlling the on/off states of each LED at specific time intervals.

3
Program (Pattern-1: R → G → B → Y) :-

DELAY:

MOV R0, #0FFH

DL1: MOV R1, #0FFH

DL2: DJNZ R1, DL2


DJNZ R0, DL1

RET

END

Program (Pattern-2: YR → RG → GB → BY) :-

ORG 0000H

4
AJMP MAIN;

ORG 0100H;

MAIN: SETB P1.0

CLR P1.1
CLR P1.2

CLR P1.3

ACALL DELAY

SETB P1.4

CLR P1.5

CLR P1.6

CLR P1.7

ACALL DELAY
SETB P1.1

CLR P1.0

CLR P1.2

CLR P1.3

ACALL DELAY

SETB P1.5

CLR P1.4
CLR P1.6

CLR P1.7

ACALL DELAY

SETB P1.2

CLR P1.0

CLR P1.1

CLR P1.3
ACALL DELAY

5
SETB P1.6

CLR P1.4

CLR P1.5

CLR P1.3
ACALL DELAY

SETB P1.3

CLR P1.0

CLR P1.1

CLR P1.2

ACALL DELAY

SETB P1.7

CLR P1.4
CLR P1.5

CLR P1.6

ACALL DELAY

SJMP MAIN

DELAY:

MOV R0, #0FFH

DL1: MOV R1, #0FFH


DL2: DJNZ R1, DL2

DJNZ R0, DL1

RET

END

Simulation Output :-

Pattern-1

 LEDs glow in the sequence: Red → Green → Blue → Yellow


Pattern-2

6
 LEDs glow in pairs:

o Yellow + Red

o Red + Green

o Green + Blue
o Blue + Yellow

Observation Table

Pattern Tested LED Sequence Delay Provided Result

Pattern-1 R→G→B→Y ~150–200 ms Working

Pattern-2 YR → RG → GB → BY ~150–200 ms Working

Circuits Screenshots :-

7
8
9
10
11
12
Result

The 8051 microcontroller successfully generated both Diwali lighting patterns using four
LEDs connected to Port-1.
The simulation in Proteus confirmed that both sequential and pair-LED patterns worked
correctly.

Conclusion

13
This experiment demonstrates how to interface LEDs with 8051 and generate creative lighting
effects by controlling port bits using assembly language. Such LED patterns are widely used in
festive lighting, decorative displays, and embedded system applications.

14

You might also like