电子钟流程图+原理图+源代码 第2页
第三章 程序框图
第四章 单片机汇编源程序
NAME ZF
PORT EQU 0CFA0H
HOUR EQU 26H ;设置数据缓冲区
BUF EQU 23H
SBF EQU 22H
MBF EQU 21H
SA EQU 27H
FA EQU 28H
HH EQU 29H
MB0 EQU 2AH
MB1 EQU 2BH
MB2 EQU 2CH
MM0 EQU 2DH
CSEG AT 0000H
LJMP START ;中断初始化
CSEG AT 0003H
LJMP KEY0
CSEG AT 0013H
LJMP KEY1
CSEG AT 401BH
LJMP CLOCK
CSEG AT 4100H
START: MOV R0, #40H ;数据缓冲区初始化
MOV R6,#00H
MOV A, #00H
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
INC R0
MOV @R0, A
MOV SP, #30H
MOV TMOD, #10H
MOV TH1, #38H
MOV TL1, #00H
MOV BUF, #00H
MOV SBF, #00H
MOV MBF, #00H
MOV HOUR,#00H
MOV SA, #00H
MOV FA, #00H
MOV HH, #00H
MOV MB0, #00H
MOV MB1, #00H
MOV MB2, #00H
MOV MM0, #00H
SETB ET1
SETB EX1
SETB PT1
SETB EA
SETB P3.5
CLR P3.0
MOV A, HOUR
ACALL GET
SJMP DS1
MIAOBIAO:JNZ DS2 ;秒表显示
MOV R0, #40H
MOV A, MB0
ACALL GET
MOV A, MB1
ACALL GET
MOV A, MB2
ACALL GET
AJMP DS1
DINGSHI: JNZ DS2 ; 定时设置显示
MOV R0, #40H
MOV A, HH
ACALL GET
MOV A, FA
ACALL GET
MOV A, SA
ACALL GET
AJMP DS1
TABLE:
INC A ;查表取段码
MOVC A, @A+PC
RET
DB 3FH
DB 06H
DB 5BH
DB 4FH
DB 66H
DB 6DH
DB 7DH
DB 07H
DB 7FH
DB 6FH
DB 40H
GET: ;将一个两位十进制数放入两个数码管对应的两个缓冲区
MOV R4, A
ANL A, #0FH
MOV @R0, A
INC R0
MOV A, R4
SWAP A
ANL A, #0FH
MOV @R0, A
INC R0
RET
CLOCK: ;定时器中断服务程序
JNB P3.0,D4 ;产生定时输出脉冲
CPL P3.4
D4: MOV TL1, #0AFH
MOV TH1, #3CH
PUSH PSW
PUSH ACC
JNB P3.5,C0 ;秒表计数模块
INC MB0
MOV A, MB0
CJNE A, #0AH,C0
MOV MB0, #00H
MOV A, MB1
INC A
DA A
MOV MB1, A
CJNE A, #60H, C0
MOV MB1, #00H
MOV A, MB2
INC A
DA A
MOV MB2, A
CJNE A, #60H, C0
MOV MB2, #00H
上一页 [1] [2] [3] 下一页
电子钟流程图+原理图+源代码 第2页下载如图片无法显示或论文不完整,请联系qq752018766