作者:爱因斯尼@SCUT
;时间:2010.08.29
;=================必要的位定义
DUAN BIT P1^5;
WEI BIT P1^6;
LIE BIT P1^7;
BELL BIT P1^4;
;=================
ORG 00H
LJMP START
ORG 0BH
LJMP Int_time0
ORG 40H
START:
SETB ET0
SETB EA
SETB TR0
MOV B,#0
MOV DPTR,#TABLE
;表格的初地址
MOV R7,#6
WAIT:
CALL SHOW_SMG
JMP WAIT
;======================数码管的字模
TABLE:
DB 0FCH,60H,0DAH,0F2H ;0,1,2,3,
DB 66H,0B6H,0BEH,0E0H ;4,5,6,7,
DB 0FEH,0F6H,0EEH,3EH ;8,9,A,b,
DB 9CH,7AH,9EH,8EH,01H ;C,d,E,F
;=======================延时子程序
DELAY:
MOV R3,#1
L3:
MOV R0,#0
L1:
MOV R1,#0
L2:
DJNZ R1,$
DJNZ R0,L1
DJNZ R3,L3
RET
;========================
SHOW_SMG:
SETB DUAN
MOV A,B
MOVC A,@A+DPTR
MOV P0,A
CLR DUAN
MOV A,#0FEH
LOOPWEI:
RL A
DJNZ R7,LOOPWEI
SETB WEI
MOV P0,A
CLR WEI
RET
;=================
Int_time0:
MOV A,B
CJNE A,#15,ADDB ;判断是否显示到F了??
MOV B,#0
JMP NEXT ;重新从0开始增加,跳过自增1
ADDB:
INC B
NEXT:
;CLR BELL
;CALL DELAY ;蜂鸣器响一下子
;SETB BELL
RETI
;=================
END
欢迎光临我们的淘宝网店:http://item.taobao.com/auction/item_detail.htm?item_num_id=9447334857
文章评论(0条评论)
登录后参与讨论