8085 微处理器模拟秒表的程序
我们编写了一个 8085 汇编语言程序,仅仅是为了模拟一个秒表,以便在地址字段中显示分钟和秒。还提供了一个暂停秒表的功能,以及继续显示在停止命令之前的时间的显示。
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
广告