PadhaikoAll subjects

Past exam question: Assignment 3, Q5(d)

Instrumentation · 3 marks

Open in the Padhaiko app

Topic: Microprocessor and microcontroller and their selection criteria, and…

Question

A/D converter requires signal to start the conversion and indicates the completion of operation with the end of conversion signal.8255A PPI is interfaced with 8085 microprocessor at 80H. Microprocessor reads 8-bit output data of the ADC at port A and displays the same data to eight LEDs connected at port B of 8255A.state any assumptions made. d) Write a program to perform the operation.

Solution

Program Logic:

  1. Initialize the 8255A by writing control word 98H to the Control Register (83H) so Port A = Input, Port B = Output, Port C Upper = Input (PC7 = EOC), Port C Lower = Output (PC0 = SOC).
  2. Send a HIGH-to-LOW Start of Conversion (SOC) pulse on PC0 using BSR words 01H and 00H written to 83H.
  3. Poll Port C (82H) and rotate PC7 (EOC) into the Carry flag with RAL; loop while CY = 0 (assume EOC goes HIGH when conversion finishes).
  4. Once CY = 1, read the 8-bit ADC data from Port A (80H), output it to the LEDs on Port B (81H), and repeat continuously.

8085 Assembly Language Program:

8085 Program: Read ADC on Port A and Display on LEDs at Port B8085 ASM
START: MVI A, 98H       ; Mode 0: PA=In, PCU=In (EOC), PB=Out (LEDs), PCL=Out (SOC)
       OUT 83H          ; Initialize 8255A Control Register
LOOP:  MVI A, 01H       ; BSR word: Set PC0 = 1 (Start of Conversion HIGH)
       OUT 83H
       CALL DELAY       ; Short pulse width delay
       MVI A, 00H       ; BSR word: Reset PC0 = 0 (Start of Conversion LOW)
       OUT 83H
CHECK: IN 82H           ; Read Port C
       RAL              ; Shift bit 7 (EOC) into Carry flag
       JNC CHECK        ; Wait until EOC = 1 (conversion complete)
       IN 80H           ; Read 8-bit ADC output from Port A
       OUT 81H          ; Display data on 8 LEDs at Port B
       JMP LOOP         ; Repeat continuously

DELAY: MVI C, 0AH       ; Short pulse-width delay
DLOOP: DCR C
       JNZ DLOOP
       RET
Answer:

The 8085 program initializes the 8255A at 83H with 98H, pulses PC0 via BSR commands (01H then 00H) to start conversion, polls PC7 (EOC) at Port C (82H) using RAL/JNC, reads the digital output from Port A (80H), and writes it to the eight LEDs on Port B (81H) in a continuous loop.

All past exam questions for Instrumentation