Saturday, October 3, 2026

Traffic light controller - Interfacing 8255 with 8085 | 8085 Lab Program

 Section: Hardware Interfacing Experiments

Aim: To design a traffic light controller using the 8085 microprocessor through the Programmable Peripheral Interface 8255.

Apparatus Required: 8085 µp kit, 8255 Interface board, DC regulated power supply, VXT parallel bus, Traffic light controller interface board.

Algorithm:

  1. Start.
  2. Write the control word to initialize the 8255 IC. Obtain the signal data for each direction and store it in memory.
  3. Initialize a counter to indicate the number of directions.
  4. Initialize the HL pair to the starting address of the data.
  5. Send the control/status data to the ports.
  6. Call a delay subroutine between signal switching.
  7. Decrement the counter and repeat the process for all directions.

Program:

AddressLabelMnemonicsOperandComment
4100LXIH, DataLoad the data starting address in HL register pair
4103MVIC, 04Move 04 to C register for 4 directions
4105MOVA, MMove control word to Accumulator
4106OUTCNTSend control word to control register
4108INXHIncrement HL pair
4109LOOP1MOVA, MMove Port C signal data to Accumulator
410AOUTCPRTSend status word to Port C
410CINXHIncrement HL pair
410DMOVA, MMove Port B signal data to Accumulator
410EOUTBPRTSend status word to Port B
4110INXHIncrement HL pair
4111MOVA, MMove Port A signal data to Accumulator
4112OUTAPRTSend status word to Port A
4114CALLDELAYCall delay subroutine
4117INXHIncrement HL pair
4118DCRCDecrement direction counter C
4119JNZLOOP1Jump to LOOP1 if counter is non-zero
411CJMPSTARTRepeat traffic cycle
411FDELAYPUSHBPush BC register pair onto stack
4120MVIC, 0DMove 0D to C register
4122LOOP3LXID, FFFFHLoad DE pair with FFFFH
4125LOOP2DCXDDecrement DE pair
4126MOVA, DCopy D to Accumulator
4127ORAEOR Accumulator with E
4128JNZLOOP2Loop until DE becomes 0
412CJNZLOOP3Loop until C becomes 0
412FPOPBPop BC pair from stack
4130RETReturn to main program

Observation:

  • Mode 0 (Simple I/O) control word is sent to initialize Ports A, B, and C as output ports.
  • Output signals are sent sequentially to Port A, Port B, and Port C to illuminate Red, Yellow, and Green LEDs for four traffic directions with designated delay intervals.

Result: Thus the design of traffic light controller using 8085 microprocessor through programmable peripheral interface 8255 is done and the output is verified.

Flowchart:

               +-------------------+
               |       START       |
               +---------+---------+
                         |
                         v
               +-------------------+
               | Initialize 8255   |
               | Write Control Word|
               +---------+---------+
                         |
                         v
               +-------------------+
               | Load Data Pointer |
               |   [HL] <- Data    |
               +---------+---------+
                         |
                         v
               +-------------------+
               |    [C] <- 04H     |
               | (4 Directions)    |
               +---------+---------+
                         |
                         v <-------------------+
               +-------------------+           |
               | Output Signals to |           |
               | Ports C, B, and A |           |
               +---------+---------+           |
                         |                     |
                         v                     |
               +-------------------+           |
               |   Call Delay      |           |
               |   Subroutine      |           |
               +---------+---------+           |
                         |                     |
                         v                     |
               +-------------------+           |
               |   [C] <- [C] - 1  |           |
               +---------+---------+           |
                         |                     |
                         v                     |
                       /   \                   |
                     /  Is   \                 |
                   /  [C] = 0? \               |
                  <             >              |
                   \ Is zero?  / --- NO -------+
                     \       /
                       \   /
                        | YES
                        v
               +-------------------+
               | Jump to START     |
               | (Continuous Loop) |
               +-------------------+

Viva Questions:

  1. When the 8255 is reset, its I/O ports are all initialized as what?
  2. If the programmable counter timer 8254 is set in mode 1 and is to be used to count six events, the output will remain at logic 0 for how many number of counts?
  3. The devices that provide the means for a computer to communicate with the user or other computers are referred to as what?
  4. What is the maximum number of I/O devices which can be interfaced in the memory-mapped I/O technique?
  5. Interaction between a CPU and a peripheral device that takes place during an input/output operation is known as what?
  6. What is the other name for Programmable Peripheral Input-Output port?
  7. All the functions of the ports of 8255 are achieved by programming the bits of an internal register called what?
  8. What is the port that is used for the generation of handshake lines in Mode 1 or Mode 2?
  9. What is the pin that clears the control word register of 8255 when enabled?
  10. In 8255, if A1 = 0 and A0 = 1, then from where is the input read cycle performed?


For all 2026 published articles list: click here: 

…till the next post, bye-bye & take care