8255 Internal Addressing and Control Word Register - 1.3 | EXPERIMENT NO. 3 TITLE: Parallel I/O Interfacing with 8085 (8255 Programmable Peripheral Interface) | Microcontroller Lab
K12 Students

Academics

AI-Powered learning for Grades 8–12, aligned with major Indian and international curricula.

Professionals

Professional Courses

Industry-relevant training in Business, Technology, and Design to help professionals and graduates upskill for real-world careers.

Games

Interactive Games

Fun, engaging games to boost memory, math fluency, typing speed, and English skills—perfect for learners of all ages.

Interactive Audio Lesson

Listen to a student-teacher conversation explaining the topic in a relatable way.

Understanding the 8255 Addressing

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Let's start by discussing the addressing scheme for the 8255 PPI. Can anyone tell me the I/O addresses for Port A, Port B, Port C, and the Control Word Register if we assume a base address of 80H?

Student 1
Student 1

Port A would be 80H, Port B would be 81H, Port C would be 82H, and the Control Word Register would be 83H.

Teacher
Teacher

Exactly! This addressing scheme allows the 8085 to communicate effectively with the 8255. Remember, the first 3 bits of the addresses correspond to A1 and A0 to differentiate the ports and the control register.

Student 2
Student 2

So, how does the 8085 know when to select each port?

Teacher
Teacher

Good question! The Chip Select signal is crucial. The decoding logic generates the CS signal that enables the 8255 based on address lines. Always remember: CS must be low to communicate with the 8255!

Student 3
Student 3

Can you elaborate more on the configuration process?

Teacher
Teacher

Sure! The next concept we need to master is the control word format, which specifies how the device's ports are set up for input or output. Let's move on to that.

Control Word Structure

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Now, let's dissect the control word format. The first bit, D7, is the Mode Set Flag. Can anyone tell me its value for I/O mode?

Student 4
Student 4

It should be 1 in I/O mode!

Teacher
Teacher

That's right! The following bits define the operational modes for both Group A and Group B. Who can explain what modes are available for Port A?

Student 1
Student 1

Port A can operate in Mode 0, Mode 1, and Mode 2.

Teacher
Teacher

Correct! Mode 0 is for basic I/O, while Modes 1 and 2 include handshaking capabilities. Always remember, the configuration directly influences how we can use the ports!

Student 2
Student 2

What about the direction setting in the control word?

Teacher
Teacher

Great point! The bits indicate whether each port is an input or an output, which is pivotal for designing your interfaces. Understanding this helps in writing correct assembly programs to control peripherals.

Student 3
Student 3

Can we practice calculating a control word together?

Teacher
Teacher

Absolutely! Let's create a scenario and calculate the control word as a group.

Modes of Operation

Unlock Audio Lesson

Signup and Enroll to the course for listening the Audio Lesson

0:00
Teacher
Teacher

Now we turn our attention to the modes of the 8255. We have two primary modes: BSR and I/O. Can someone explain the key differences?

Student 4
Student 4

BSR mode is for setting or resetting bits in Port C, while I/O mode is for configuring ports for general purpose input/output.

Teacher
Teacher

Very good! That's a crucial distinction. I/O mode can be divided into three different operational sub-modes: Can anyone name them?

Student 1
Student 1

They are Mode 0, Mode 1, and Mode 2!

Teacher
Teacher

Well done! Mode 0 functions as simple I/O without handshaking. Mode 1 introduces handshaking for data transfers, while Mode 2 allows bidirectional communication. Knowing when to use each mode is key!

Student 3
Student 3

Is there any practical application you can share to illustrate this?

Teacher
Teacher

Absolutely! Mode 0 is commonly used in situations where we want to output static data to LEDs, while Modes 1 and 2 are more prevalent in situations involving communication with sensors or data reception.

Student 4
Student 4

This makes it clearer to understand where we apply each mode!

Introduction & Overview

Read a summary of the section's main ideas. Choose from Basic, Medium, or Detailed.

Quick Overview

This section focuses on the internal addressing scheme and control word format specific to the 8255 Programmable Peripheral Interface (PPI), which is essential for interfacing with 8085 microprocessors.

Standard

Key topics include the internal addressing for communication with the 8255, the various operational modes of the device, and the structure of its control word. It serves as a foundation for understanding how to configure the 8255 for specific input/output applications, particularly when interfacing with the 8085 microprocessor.

Detailed

Detailed Summary

The section provides an in-depth exploration of the internal addressing and control word register of the 8255 Programmable Peripheral Interface (PPI), a vital component for effective communication between the 8085 microprocessor and peripheral devices. The section begins by defining the unique addresses for Port A, Port B, Port C, and the Control Word Register, illustrated with examples. A conceptual understanding of how the 8255 operates in different modes—Bit Set/Reset (BSR) Mode and I/O Mode—is discussed, highlighting the specific configuration of these modes through control word formatting. The structure of the control word is detailed, breaking down each bit's significance in configuring the PPI for various operational modes, making it key to implement applications that involve interfacing with LEDs and switches. Understanding this section enables the reader to proficiently set up and program the 8255 for diverse input/output operations, establishing a crucial step in microcontroller applications.

Audio Book

Dive deep into the subject with an immersive audiobook experience.

Addresses for 8255 and Control Word Register

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

To communicate with the 8255, the 8085 needs to know its unique addresses for Port A, Port B, Port C, and the Control Word Register (CWR). These addresses are determined by the external address decoding logic that generates the CS signal for the 8255, combined with the 8255's internal A0 and A1 pins.

Let's assume the address decoding logic enables the 8255 for base address 80H. Then, the I/O addresses for the 8255 would be:
- Port A: 80H (A1=0, A0=0)
- Port B: 81H (A1=0, A0=1)
- Port C: 82H (A1=1, A0=0)
- Control Word Register (CWR): 83H (A1=1, A0=1)

Detailed Explanation

To communicate with the 8255, a special addressing system is used, where each port and control register has a unique address. The base address is set as 80H in this example, and from this base, the addresses for Port A, Port B, Port C, and the Control Word Register are derived. Each of these components has a specific I/O address: Port A is at 80H, Port B is at 81H, Port C at 82H, and the Control Word Register at 83H. This addressing scheme allows the 8085 microprocessor to correctly interact with the 8255 by reading from or writing to these specific addresses.

Examples & Analogies

Think of it like mailing letters to various departments in a building. Each department has a specific room number (address) where mail should be sent. If you want to send a letter to the Sales department, you need to know that their room is 80 (80H), whereas the HR department might be number 81 (81H). Just like how a letter reaches its destination only if sent to the correct room, data must be sent to the correct addresses to communicate with the 8255.

Primary Modes of 8255 Operation

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

The 8255 can operate in two primary modes:
1. Bit Set/Reset (BSR) Mode: Only applicable to Port C. Allows individual bits of Port C to be set (high) or reset (low) without affecting other bits.
2. I/O Mode: Configures Ports A, B, and C as input or output ports. This mode has three sub-modes:
- Mode 0 (Basic I/O): All ports (A, B, C) can be configured as simple latched outputs or buffered inputs. No handshaking signals are used. This is the simplest mode and most common for basic parallel I/O.
- Mode 1 (Strobed I/O): Used for data transfer with handshaking signals. Port A and Port B use Port C lines for handshaking.
- Mode 2 (Bidirectional I/O): Only Port A can be configured in this mode. It allows Port A to be used for both transmitting and receiving data simultaneously, with handshaking.

Detailed Explanation

The 8255 PPI has two primary modes of operation: BSR Mode and I/O Mode. BSR Mode allows for individual manipulation of bits in Port C without influencing the other bits, which is useful for control applications. On the other hand, I/O Mode lets the user configure the ports for general input/output functionality. I/O Mode has different sub-modes: Mode 0 is for simple input and output, Mode 1 includes handshaking signals to ensure data integrity during transfers, and Mode 2 is used for simultaneous data transmission and reception, enhancing communication functionality.

Examples & Analogies

Imagine a multi-function printer. It can work in different modes depending on what you want it to do: printing, scanning, or faxing. Each mode has specific settings. Mode 0 is like just printing papers without any special requirements; Mode 1 requires confirmation that the printer is ready before it sends prints (like handshaking). Mode 2 is like using a printer that can copy and scan at the same time, handling both tasks concurrently.

Control Word Format for 8255

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

The functionality of the 8255 is configured by writing a specific 8-bit Control Word to its Control Word Register (CWR). The format of this word depends on whether you are setting up I/O modes or using the Bit Set/Reset feature.

A. I/O Mode Set Control Word (D7 = 1): This control word is written to address 83H (or corresponding CWR address) to configure the modes and directions of Ports A, B, and C.

D7 D6 D5 D4 D3 D2 D1 D0

1 M1 M0 PA PCU M2 PB PCL

  • D7 (Mode Set Flag): Always 1 for I/O mode set.
  • D6, D5 (Group A Mode Select - M1 M0):
  • 00 = Mode 0 (Basic I/O for Port A)
  • 01 = Mode 1 (Strobed I/O for Port A)
  • 1X = Mode 2 (Bidirectional I/O for Port A)
  • D4 (Port A Direction): 1 = Input, 0 = Output
  • D3 (Port C Upper Direction - PC4-PC7): 1 = Input, 0 = Output
  • D2 (Group B Mode Select - M2):
  • 0 = Mode 0 (Basic I/O for Port B)
  • 1 = Mode 1 (Strobed I/O for Port B)
  • D1 (Port B Direction): 1 = Input, 0 = Output
  • D0 (Port C Lower Direction - PC0-PC3): 1 = Input, 0 = Output.

Detailed Explanation

To operate the 8255, a Control Word must be sent to the Control Word Register (CWR). This Control Word is an 8-bit binary value that determines how each port behaves (input or output) and which operational mode is set. The D7 bit is set to 1 to indicate that we are configuring ports for I/O operations. The subsequent bits provide details about the modes for Ports A and B, and the directions for each port (input or output). For example, if you wanted Port A to be an output and Port B to be an input, you would set those bits accordingly in the Control Word.

Examples & Analogies

Think of the Control Word as a set of instructions for a chef in a kitchen. Each bit in the Control Word gives specific tasks: should the chef bake (bit for output) or prepare ingredients (bit for input). Just like how the chef needs a clear instruction list to perform their job effectively, the 8255 requires the Control Word to know how to handle each port.

Example of I/O Mode Control Word Calculation

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

Let's configure the 8255 as follows:
- Port A = Output (Mode 0)
- Port B = Output (Mode 0)
- Port C Lower (PC0-PC3) = Output (Mode 0)
- Port C Upper (PC4-PC7) = Input (Mode 0)

Breaking down the bits for the Control Word:
- D7 = 1 (I/O Mode Set)
- D6, D5 = 00 (Group A - Mode 0)
- D4 = 0 (Port A Output)
- D3 = 1 (Port C Upper Input)
- D2 = 0 (Group B - Mode 0)
- D1 = 0 (Port B Output)
- D0 = 0 (Port C Lower Output)

Combining these bits: 1 00 0 1 0 0 0 (binary) = 10001000b = 88H (hexadecimal). So, to achieve this configuration, you would write 88H to the Control Word Register (e.g., address 83H).

Detailed Explanation

To set the 8255 for a specific configuration, you need to translate your requirements into an 8-bit binary Control Word. In this example, you want Port A and Port B to be outputs, while Port C's lower bits are outputs, and the upper bits are inputs. By setting the bits according to their required functions (input/output) in the correct order, you generate the final binary code. In this case, it turns out to be 10001000 in binary, which is 88 in hexadecimal. This Control Word is then sent to the Control Word Register to set up the device.

Examples & Analogies

Picture a manager creating a work schedule for employees. Each part of the schedule defines tasks for different days of the week (like input/output for different ports). If Monday and Tuesday are assigned output tasks, while Saturday is set for input tasks, the manager adjusts the schedule to clearly reflect these duties. The resulting schedule is similar to the Control Word: a clear set of instructions ready for employees (the ports) to follow.

Bit Set/Reset Mode Control Word

Unlock Audio Book

Signup and Enroll to the course for listening the Audio Book

This control word is used to individually set or reset any one of the 8 bits of Port C. It is also written to the Control Word Register (e.g., address 83H).

D7 D6 D5 D4 D3 D2 D1 D0

0 X X X B2 B1 B0 S/R
- D7 (Mode Set Flag): Always 0 for BSR mode.
- D6, D5, D4 (Don't Care): Value does not matter (often set to 0).
- D3, D2, D1 (Bit Select - B2 B1 B0): These three bits select which of the 8 bits of Port C (PC0-PC7) is to be set or reset.
- D0 (Set/Reset): 1 = Set the selected bit, 0 = Reset the selected bit.

Detailed Explanation

The Bit Set/Reset (BSR) mode allows you to manipulate the bits of Port C individually. The Control Word for this mode has the D7 bit set to 0. The next three bits (D6, D5, D4) do not matter, and the remaining bits define which specific bit (from PC0 to PC7) you wish to change (set or reset). This mode is useful when you need to control individual lines for flags or signals without affecting the others.

Examples & Analogies

Think of a light switch panel with multiple switches controlling different lights (Port C bits). If you want to turn off just the light on switch 4 while keeping the others on, you would use the BSR mode. You simply target that specific switch and flip it (set or reset), without impacting the states of the other switches.

Definitions & Key Concepts

Learn essential terms and foundational ideas that form the basis of the topic.

Key Concepts

  • Control Word: The configuration word written to the CWR to set operational modes.

  • I/O Address: Unique addresses for accessing specific ports and registers of the 8255.

  • Modes of Operation: Different setups for input and output functionality of the ports.

Examples & Real-Life Applications

See how the concepts apply in real-world scenarios to understand their practical implications.

Examples

  • Configuring the 8255 to drive LEDs based on the control word sent to Port A.

  • Reading the switch states using Port B and outputting results on Port C.

Memory Aids

Use mnemonics, acronyms, or visual cues to help remember key information more easily.

🎵 Rhymes Time

  • The 8255 aids in communication, with Modes like I/O for data transmission.

📖 Fascinating Stories

  • Imagine a bus where each port is like a bus stop. Depending on what time it is, the ports are either busy taking passengers or ready to pick them up.

🧠 Other Memory Gems

  • Remember 'I O B A C' for I/O configuration: Input, Output, Bit Set/Reset, Address Control.

🎯 Super Acronyms

PPI

  • Programmable Peripheral Interface – Perfectly Positioned to Integrate.

Flash Cards

Review key concepts with flashcards.

Glossary of Terms

Review the Definitions for terms.

  • Term: 8255 PPI

    Definition:

    A Programmable Peripheral Interface that allows microprocessors to interface with multiple inputs and outputs.

  • Term: Control Word Register (CWR)

    Definition:

    An internal register of the 8255 that configures the operation of its ports.

  • Term: Chip Select (CS)

    Definition:

    A control signal that enables or disables the 8255 for communication.

  • Term: Bit Set/Reset (BSR) Mode

    Definition:

    A mode of the 8255 that allows individual bits of Port C to be set or reset.

  • Term: I/O Mode

    Definition:

    A configuration mode that sets up the ports as input or output.