PadhaikoAll subjects

Past exam question: Assignment 3, Q7

Instrumentation · 5 marks

Open in the Padhaiko app

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

Question

Write an ALP to generate a triangular wave of frequency 500Hz using the same interfacing circuit. The amplitude of the triangular wave should be +5V.

Solution

Interfacing Setup and Assumptions:

On a standard 8085 (), . A single 8-bit loop (OUT + INR + CPI + JNZ = ) stepping by ( steps) takes per half-cycle (). To achieve exactly on a 8085, step by ( exact steps from 00H to FFH and back):

Using OUT 00H (), ADI 03H (), NOP (), CPI FFH (), JNZ UP (): wait — (), or without NOP: (, ). That matches within !

8085 Assembly Language Program (500 Hz, +5 V Triangular Wave):

8085 ALP: 500 Hz, +5 V Triangular Wave via 8255 Port A (00H)8085 ASM
        MVI A, 80H      ; Mode 0: All ports Output
        OUT 03H         ; Write control word to 8255 CWR (03H)

START:  MVI A, 00H      ; Start ramp at 0V (00H)
UP:     OUT 00H         ; [10 T] Output voltage sample to DAC at Port A (00H)
        ADI 03H         ; [ 7 T] Increment by 3 (85 steps to reach FFH = +5V)
        CPI FFH         ; [ 7 T] Reached peak (+5V)?
        JNZ UP          ; [10 T] Repeat rising slope (34 T-states/step)

DOWN:   OUT 00H         ; [10 T] Output peak / falling samples to DAC
        SUI 03H         ; [ 7 T] Decrement by 3 (85 steps back to 00H = 0V)
        JNZ DOWN        ; [10 T] Repeat falling slope
        JMP START       ; [10 T] Repeat continuously for 500 Hz triangular wave
Answer:

Initializing 8255 Port A (00H) as Mode 0 output with control word 80H at CWR (03H), the ALP ramps A from 00H () up to FFH () and back down to 00H in steps of (ADI 03H / SUI 03H), yielding a half-period of and total period () on a 8085.

All past exam questions for Instrumentation