本帖最后由 2973537 于 2016-7-14 00:16 编辑
org 000h
ljmp start
org 000bh
ljmp zhong
org 30h
start:mov sp,#30h
mov 05h,#00h
mov 06h,#00h
mov p3,#11111111b
mov tmod,#01h
mov th0,#high(32207)
mov tl0,#low(32207)
setb tr0
setb et0
setb ea
mov 04h,#1
start1:jnb p3.4,jiaw
jnb p3.3,jian
lcall look
jin:mov a,04h
cjne a,#0,start1
mov 00h,#250
mov 01h,#30
lcall fmcx
clr p3.2
ljmp start1
jiaw:mov 00h,#50
mov 01h,#2
lcall fmcx
jiaw1:lcall look
jnb p3.4,jiaw1
mov a,#5
add a,04h
jc jiaw2
mov 04h,a
ljmp jin
ret
jiaw2:mov a,#255
mov 04h,a
ljmp jin
ret
jian:mov 00h,#50
mov 01h,#2
lcall fmcx
jian1:lcall look
jnb p3.3,jian1
mov a,04h
clr c
subb a,#5
jc jian2
mov 04h,a
ljmp jin
ret
jian2:mov a,#1
mov 04h,a
ljmp jin
ret
look:mov 03h,04h
mov a,03h
mov b,#100
div ab
mov dptr,#disptab
movc a,@a+dptr
mov p1,a
setb p3.0
lcall d1
clr p3.0
mov p1,#11111111b
lcall d1
mov a,b
mov b,#10
div ab
mov dptr,#disptab
movc a,@a+dptr
mov p1,a
setb p3.5
lcall d1
clr p3.5
mov p1,#11111111b
lcall d1
mov a,b
mov dptr,#disptab
movc a,@a+dptr
mov p1,a
setb p3.7
lcall d1
clr p3.7
mov p1,#11111111b
lcall d1
ret
fmcx:setb p3.1
lcall d1
cpl p3.1
lcall d1
djnz 00h,fmcx
djnz 01h,fmcx
ret
d1:mov 02h,#41
d2:djnz 02h,d2
ret
zhong:mov tmod,#01h
mov th0,#high(32207)
mov tl0,#low(32207)
setb tr0
push acc
push psw
inc 05h
mov a,05h
cjne a,#10,cuzan
mov 05h,#00h
inc 06h
mov a,06h
cjne a,#60,cuzan
mov 06h,#00h
dec 04h
mov a,04h
cjne a,#0,cuzan
clr tr0
cuzan:pop acc
pop psw
reti
disptab:db 11111010b,00100010b,10111001b,10101011b,01100011b,11001011b,11011011b,10100010b,11111011b,11101011b
end改成这样了,可以每分钟倒计时了,但是数码管有鬼影,
|