Program for simulating a stopwatch in 8085 Microprocessor

MicroprocessorMicrocontroller8085

We write an 8085 assembly language program just to simulate a stopwatch for displaying minutes and seconds in the address field. There exists a provision to stop the stopwatch, along with the display for continuation to show the time just previous to the stop command.

FILE NAME STOPWACH.ASM
PRESSING THE ‘VECT INTR’ KEY STOPS THE STOPWATCH, WITH STATIONARY DISPLAY
ORG C000H
CURAD: EQU FFF7H
UPDAD: EQU 06BCH

RESET: LXI H,0000H
REPEAT: SHLD CURAD
CALL UPDAD; Display time present in HL in the address field
MVI A, 00011011B
SIM ; Unmask RST7.5, Reset RST7.5 flip flop
EI ; Enable interrupt system

CALL DELAY ; Generate a delay of 1 second

LHLD CURAD
MOV A, L
ADI 01H
DAA ; Increment L value in decimal
CPI 60H
JZ INC_MIN ; If L = 60, jump to INC_MIN

MOV L, A
JMP REPEAT

INC_MIN:

MVI L, 00H
MOV A, H
ADI 01H
DAA ; Make L = 0, and increment H in decimal
CPI 60H
JZ RESET ; If H = 60, jump to RESET

MOV H, A
JMP REPEAT

; Subroutine to generate a delay of 1 second

; To check the proper working of minutes display, load DE with
; 0444H in this subroutine instead of FFFFH. Then the minutes’ display
; will change every second, so that we can test the proper working in
; 60 seconds, instead of waiting for 60 minutes.

DELAY: MVI B, 02H
OUTLOOP: LXI D, FFFFH

INLOOP: DCX D
MOV A, D
ORA E
JNZ INLOOP

DCR B
JNZ OUTLOOP
RET

RST7.5 Interrupt Service Subroutine

ORG FFB1H ; For ESA Kit it should be ‘ORG 8FBFH’
HLT ; ; This is the RST7.5 ISS
raja
Published on 13-Mar-2019 06:18:04
Advertisements