LED Interfacing
LED Interfacing
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 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
• 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: