高手请教在程序内部出现的问题怎么改呀???????/
; DS12C887 内部专用寄存器宏定义
MIN XDATA 7F02H
HOUR XDATA 7F04H
WEEK XDATA 7F06H
DAY XDATA 7F07H
MONTH XDATA 7F08H
YEAR XDATA 7F09H
REG_A XDATA 7F0AH
REG_B XDATA 7F0BH
;工作模式状态暂存寄存器
STATUS DATA 20H
;可修改时间参数
MIN2 DATA 21H
HOUR2 DATA 22H
WEEK2 DATA 23H
DAY2 DATA 24H
MONTH2 DATA 25H
YEAR2 DATA 26H
;读取DS12C887内部时间数据存储单元
MIN1 DATA 27H
HOUR1 DATA 28H
WEEK1 DATA 29H
DAY1 DATA 2AH
MONTH1 DATA 2BH
YEAR1 DATA 2CH
ORG 000H
MAIN:
MOV DPTR,#REG_A
MOVX A,@DPTR
ANL A,#0AFH
MOVX @DPTR,A
MOV DPTR,#REG_A
MOVX A,@DPTR
ORL A,#20H
MOVX @DPTR,A
MOV DPTR,#REG_B
MOVX A,@DPTR
ANL A,#7BH
MOVX @DPTR,A
MOV DPTR,#REG_A
MOVX A,@DPTR
ORL A,#02H
MOVX @DPTR,A
LOOP:NOP
LCALL GETTIME
LJMP LOOP
;设置日历和时钟函数
SETTIME:
MOV DPTR,#REG_B
MOVX A,@DPTR
ORL A,#80H
MOVX @DPTR,A
MOV DPTR,#MIN
MOV A,MIN1
MOVX @DPTR,A
MOV DPTR,#HOUR
MOV A,HOUR1
MOVX @DPTR,A
MOV DPTR,#WEEK
MOV A,WEEK1
MOVX @DPTR,A
MOV DPTR,#MONTH
MOV A,MONTH1
MOVX @DPTR,A
MOV DPTR,#YEAR
MOV A,YEAR1
MOVX @DPTR,A
MOV DPTR,#REG_B
MOVX A,@DPTR
ANL A,#80H
MOVX @DPTR,A
RET
;获取日历时钟函数
GETTIME: MOV DPTR,#REG_B
MOVX A,@DPTR
JB A.7, GETTIME ;汇编时为什么出现操作数错,怎么改
MOV DPTR,#MIN
MOVX A,@DPTR
MOV MIN2,A
MOV DPTR,#HOUR
MOVX A,@DPTR
MOV HOUR2,A
MOV DPTR,#WEEK
MOVX A,@DPTR
MOV WEEK2,A
MOV DPTR,#DAY
MOVX A,@DPTR
MOV DAY2,A
MOV DPTR,#MONTH
MOVX A,@DPTR
MOV MONTH2,A
MOV DPTR,#YEAR
MOVX A,@DPTR
MOV YEAR2,A
RET
END |