SPKEQUP3.7; 蜂鸣器地点端口
COUNT50EQU39H
SECEQUR0
MINEQUR1
SEGEQUP2
NUMEQUP0
SEG7EQU30H
SEG6EQU31H
SEG5EQU32H
SEG4EQU33H
SEG3EQU36H
SEG1EQU 3AH
DLAYEQU34H
H_CNT1EQU37H
H_CNT2EQU38H
FLAGBIT 00H
KEYVALEQU40H
XUN1EQU41H
XUN2EQU42H
MUSICEQU43H
ORG0000H
LJMPMAIN
ORG0003H
LJMP PLY_PAU
ORG0013H
LJMP STOP
ORG000BH;守时0中止服务程序
LJMP COUNT
;——————————————————
ORG100H
MAIN:MOVSP,#60H;初始化仓库
MOVSEC,#0H;初始化秒
MOVMIN,#0H;初始化分
MOVCOUNT50,#50;一秒守时
CLRFLAG
MOVIE,#8FH
MOVTMOD,#11H
MOVTH0,#0A5H
MOVTL0,#0FFH
MOVTH1,#0EDH
MOVTL1,#0FFH
SETBIT0
SETBIT1
MOVKEYVAL,#00H
MOVMUSIC,#01H
MOVDPTR,#TABLE1
MOV37H,#0FFH
MOV38H,#05H
;**************欢迎界面**********************
HELLO:MOV30H,#7FH
MOV31H,#0BFH
MOV32H,#0DFH
MOV33H,#0EFH
MOV36H,#0F7H
MOV 3AH,#0FDH
MOVP2,SEG3;H
MOVP0,#89H
LCALL LDELAY
MOVP2,SEG4;E
MOVP0,#86H
LCALL LDELAY
MOVP2,SEG5;L
MOVP0,#0C7H
LCALL LDELAY
MOVP2,SEG6;L
MOVP0,#0C7H
LCALL LDELAY
MOVP2,SEG7;O
MOVP0,#0C0H
LCALL LDELAY
MOVA,KEYVAL
JNZKEYJDG
DJNZ H_CNT1, HELLO
DJNZ H_CNT2,HELLO
;==========================================================
SETBTR0
LJMP SING
KEYGET:LCALL KEY
MOVA,KEYVAL
JZKEYGET
KEYJDG:CJNE A,#12H,SECON
FIRST1:MOVDPTR,#TABLE1
MOVMUSIC,#01H
MOVKEYVAL,#00H
;SETBFLAG
MOVSEC,#00H
MOVMIN,#00H
MOVCOUNT50,#50
SETBTR0
LJMP SING
SECON:CJNE A,#11H,THIR
SECON1:MOVDPTR,#TABLE2
MOVMUSIC,#02H
MOVKEYVAL,#00H
;SETBFLAG
MOVSEC,#00H
MOVMIN,#00H
MOVCOUNT50,#50
SETBTR0
LJMP SING
THIR:CJNE A,#0FH,FORTH
THIR1:MOVDPTR,#TABLE3
MOVMUSIC,#03H
MOVKEYVAL,#00H
;SETBFLAG
MOVSEC,#00H
MOVMIN,#00H
MOVCOUNT50,#50
SETBTR0
LJMP SING
FORTH:CJNE A,#0BH,UP
FORTH1:MOVDPTR,#TABLE4
MOVMUSIC,#04H
MOVKEYVAL,#00H
;SETBFLAG
MOVSEC,#00H
MOVMIN,#00H
MOVCOUNT50,#50
SETBTR0
LJMP SING
UP:CJNE A,#02H,DOWN
MOVKEYVAL,#00H
MOVR5,MUSIC
CJNE R5,#00H,N1
LJMP KEYGET
N1:CJNE R5,#01H,N2
LJMP FORTH1
N2:CJNE R5,#02H,N3
LJMP FIRST1
N3:CJNE R5,#03H,N4
LJMP SECON1
N4:LJMP THIR1
DOWN:; LCALL VLDELAY
MOVR5,MUSIC
MOVKEYVAL,#00H
CJNE R5,#00H,M1
LJMP KEYGET
M1:CJNE R5,#01H,M2
LJMP SECON1
M2:CJNE R5,#02H,M3
LJMP THIR1
M3:CJNE R5,#03H,M4
LJMP FORTH1
M4:LJMP FIRST1
;———————————————————–
KEY: PUSH ACC
MOVP1,#0F0H;置列线为0,行线为1 ;^^^^^^^^^^^^
MOVA,P1
ANLA,#0F0H
MOVB,A
MOVP1,#0FH;置列线为1,行线为0
MOVA,P1
ANLA,#0FH
ORLA,B
CJNE A,#0FFH,UUU
AJMP QICH
UUU:CLRC
SUBB A,#0DCH
JNCHAHA
QICH:CLRA
HAHA:MOVKEYVAL,A
POP ACC
RET
;————————————————————-
;————————————————————-
;**************守时中止服务程序***********************
COUNT:MOVTH0,#0A5H
MOVTL0,#0FFH
LCALL KEY
JNBFLAG,RETURN
DJNZ COUNT50,RETURN ;是否到一秒
;*****一秒处理****************
MOVCOUNT50,#50
INCSEC
CJNE SEC,#60,RETURN
MOVSEC,#0H
INCMIN
CJNE MIN,#100,RETURN ;一百分钟今后主动清零
MOVMIN,#00H
RETURN: LCALL DISPLAY
RETI
;**************************************************
;**************显现子程序*******************
DISPLAY:PUSHACC
PUSHB
PUSH DPH
PUSH DPL
MOVA,MIN
MOVB,#0AH
DIVAB
MOVSEG,SEG4
LCALL TODIS
LCALL DELAY
MOVSEG,SEG5
MOVA,B
MOVDPTR,#TABLE
MOVC A,@A+DPTR
ANL A,#7FH
MOVNUM,A
LCALL DELAY
MOVA,SEC
MOVB,#10
DIVAB
MOVSEG,SEG6
LCALL TODIS
LCALL DELAY
MOVSEG,SEG7
MOVA,B
LCALL TODIS
LCALL DELAY
MOVA,MUSIC
MOVSEG,SEG1
LCALL TODIS
POP DPL
POP DPH
POPB
POPACC
RET
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/fangan/dianlu/255874.html