0% found this document useful (0 votes)
66 views

LED Interfacing

Uploaded by

Vijayaraghavan L
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)
66 views

LED Interfacing

Uploaded by

Vijayaraghavan L
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
You are on page 1/ 16

LED Interfacing

Types of modes for LED operation

•BSR Mode: Bit-level control (Port C only).


•I/O Mode: Full-port input/output control
(Ports A, B, and C).
What is control word?

1. The control word is given by the


microprocessor to configure the operation of the
8255 PPI.
2. It defines whether the ports are used for input or
output and in which mode.
3. It also allows the microprocessor to control
individual bits of Port C in BSR mode.
BSR Mode

Port C
Selected
bit
1. BSR Mode (Bit Set/Reset Mode)
Example 1: Controlling LEDs
• Scenario: You have 8 LEDs
connected to the 8 bits of Port C.
You want to turn specific LEDs on or
off without affecting others.
• How It Works:
• Using BSR mode, you can set or reset
individual bits of Port C.
• For example, if LED 4 is connected to
pin 4 of Port C, you can use BSR mode
to set pin 4 (turn the LED on) or reset it
(turn the LED off) without disturbing
other pins.
I/O vs BSR mode

• If you are using I/O mode and want to output a value to


Port A, you send an 8-bit value (e.g., 11001100), and all 8
bits of Port A are updated at once.

• If you want to turn ON only PC3 (a single bit of Port C), you
need to use BSR mode to set only that specific bit, without
affecting the other bits of Port C.
1. What is an 8-bit LED Display?
• Imagine you have 8 LEDs lined up, and you want to control them
using the microprocessor and the 8255 PPI.
• Each LED can be turned ON or OFF, where:
• 1 means ON
• 0 means OFF
• By sending different combinations of 1s and 0s, you can create
different patterns on the LEDs.
2. How the 8255 PPI Works in LED Interfacing

• The 8255 PPI has three ports: Port A, Port B, and Port C.
• To control the LED display, you will typically use one of these ports
(say, Port A).
• The port (Port A) sends 8-bit data to the LEDs.
• Each bit controls one LED.
3. Configuring the PPI for Output
• Since you need to send data to the LED display to control the LEDs,
you must configure the port (Port A) as an output port.
• To do this, the control word is set to define Port A as output mode
(for example, Mode 0 – simple input/output mode).
4. How Data is Sent to the LEDs
• The 8-bit data (e.g., 11001010) is sent to Port A.
• Each bit in this data corresponds to an LED on the display:
• 1 turns an LED ON.
• 0 turns an LED OFF.
• For example:
• 11001010 means:
• The 1st, 2nd, 5th, and 7th LEDs are ON.
• The 3rd, 4th, 6th, and 8th LEDs are OFF.
5. Step-by-Step Process

Step 1: Initialize 8255 PPI


1. First, the 8255 PPI needs to be initialized by sending a control word.
2. The control word tells the 8255 that Port A will be used as an output port (to send data to the
LED display).
Step 2: Sending Data to Port A
1. Once the PPI is initialized, you can send 8-bit data to Port A.
2. Each bit in the 8-bit data corresponds to one LED:
• 1 will turn the LED ON.
• 0 will turn the LED OFF.
Step 3: Observe LED Display
1. Based on the data you send, the LED display will show different patterns. For example:
• If you send 11111111, all LEDs will turn ON.
• If you send 00000000, all LEDs will turn OFF.
• If you send 10101010, alternate LEDs will be ON.
6. Control Word Example
• To set Port A as output, you D7 D6 D5 D4 D3 D2 D1 D0
send a control word to the 1 0 0 0 0 0 0 0
Control Register of the 8255
PPI.
• In Mode 0, the control word
might look something like
this:
• 10000000 (Binary) or 0x80
(Hexadecimal)
• This configures Port A as an 8-
bit output port.
7. Example

• Let’s say you want to create a blinking pattern on the LEDs. You can
write a program to:
• First send 11111111 to Port A (all LEDs ON).
• After a delay, send 00000000 to Port A (all LEDs OFF).
• Repeat this process to make the LEDs blink.
8. Applications

• LED Status Indicators: You can use this method to display status
information (like ON/OFF status of devices).
• Simple Display Patterns: You can show numbers, letters, or other
simple patterns using LEDs.
Summary:

• Port A is configured as an output port to send data to the LED display.


• 8-bit data is sent to Port A, and each bit controls one LED.
• The LEDs display the pattern based on the data (1 = ON, 0 = OFF).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy