找回密码
 注册会员
更新自动建库工具PCB Footprint Expert 2024.04 Pro / Library Expert 破解版

用89c51和ds1302这个芯片做的时钟日历 仿真不起来 各位帮我看看

[复制链接]
admin 发表于 2012-9-2 14:36:33 | 显示全部楼层 |阅读模式

本文包含原理图、PCB、源代码、封装库、中英文PDF等资源

您需要 登录 才可以下载或查看,没有账号?注册会员

×
下面是程序和 仿真图 我是菜鸟啊请大家指点下 SEC EQU 50H
MIN EQU 51H
HOUR EQU 52H
DAY EQU 53H
MON EQU 54H
WEEK EQU 55H
YEAR EQU 56H
ORG 0000H
LJMP START
ORG 0030H
START: MOV SEC,#59H
MOV MIN,#25H
MOV HOUR,#18H
MOV DAY,#10H
MOV MON,#04H
MOV WEEK,#05H
MOV YEAR,#09H
LCALL S1302
LCALL G1302
LCALL DISPLAY
MOV R5,#25
MOV TMOD,#01H
MOV TH0,#63H
MOV TL0,#0C0H
SETB TR0
LOOP1: JBC TF0,LOOP2
LJMP LOOP1
LOOP2: MOV TH0,#63H
MOV TL0,#0C0H
LCALL DISPLAY
DJNZ R5,LOOP1
LCALL G1302
MOV R5,#25
LJMP LOOP1

DISPLAY: MOV A,YEAR
MOV B,#10
DIV AB
MOV 60H,A
MOV 61H,B
MOV A,WEEK
MOV B,#10
DIV AB
MOV 62H,A
MOV 63H,B
MOV A,MON
MOV B,#10
DIV AB
MOV 64H,A
MOV 65H,B
MOV A,DAY
MOV B,#10
DIV AB
MOV 66H,A
MOV 67H,B
MOV A,HOUR
MOV B,#10
DIV AB
MOV 68H,A
MOV 69H,B
MOV A,MIN
MOV B,#10
DIV AB
MOV 6AH,A
MOV 6BH,B
MOV A,SEC
MOV B,#10
DIV AB
MOV 6CH,A
MOV 6DH,B
MOV A,60H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#20H
MOV P2,#00H
MOV P0,A
LCALL DELAY
MOV A,61H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#10H
MOV P2,#00H
MOV P0,A
LCALL DELAY
MOV A,62H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#08H
MOV P2,#00H
MOV P0,A
LCALL DELAY
MOV A,63H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#04H
MOV P2,#00H
MOV P0,A
LCALL DELAY
MOV A,64H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#02H
MOV P2,#00H
MOV P0,A
LCALL DELAY
MOV A,65H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#01H
MOV P2,#00H
MOV P0,A
LCALL DELAY
MOV A,66H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#80H
MOV P0,A
LCALL DELAY
MOV A,67H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#40H
MOV P0,A
LCALL DELAY
MOV A,68H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#20H
MOV P0,A
LCALL DELAY
MOV A,69H
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#10H
MOV P0,A
LCALL DELAY
MOV A,6AH
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#08H
MOV P0,A
LCALL DELAY
MOV A,6BH
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#04H
MOV P0,A
LCALL DELAY
MOV A,6CH
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#02H
MOV P0,A
LCALL DELAY
MOV A,6DH
MOV DPTR,#TABLE
MOVC A,@A+DPTR
MOV P3,#00H
MOV P2,#01H
MOV P0,A
LCALL DELAY

TABLE: DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
DELAY: MOV R7,#1
DEL2: MOV R6,#126
DEL1: DJNZ R6,DEL1
DJNZ R7,DEL2
RET
S1302: CLR P1.5
CLR P1.6
SETB P1.5
MOV B, #8EH
LCALL RTInputByte
MOV B, #00H
LCALL RTInputByte
SETB P1.6
CLR P1.5
MOV R0, #Sec
MOV R7, #7
MOV R1, #80H
S13021: CLR P1.5
CLR P1.6
SETB P1.5
MOV B, R1
LCALL RTInputByte
MOV A, @R0
MOV B, A
LCALL RTInputByte
INC R0
INC R1
INC R1
SETB P1.6
CLR P1.5
DJNZ R7,S13021
CLR P1.5
CLR P1.6
SETB P1.5
MOV B, #8EH
LCALL RTInputByte
MOV B, #80H
LCALL RTInputByte
SETB P1.6
CLR P1.5
RET
G1302: MOV R0, #SEC
MOV R7, #7
MOV R1, #81H
G13021: CLR p1.5
CLR P1.6
SETB P1.5
MOV B, R1
LCALL RTInputByte
LCALL RTOutputByte
MOV @R0, A
INC R0
INC R1
INC R1
SETB P1.6
CLR P1.5
DJNZ R7, G13021
RTInputByte: MOV R4,#8
Inbit1: MOV A,B
RRC A
MOV B,A
MOV P1.7, C
SETB P1.6
CLR P1.6
DJNZ R4, Inbit1
RET
RTOutputByte: MOV R4, #8
Outbit1: MOV C, P1.7
RRC A
SETB P1.6
CLR P1.6
DJNZ R4,Outbit1
RET
END


5_52916_c6719969bbb793c.jpg
*滑块验证:
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

QQ|手机版|MCU资讯论坛 ( 京ICP备18035221号-2 )|网站地图

GMT+8, 2024-11-25 04:34 , Processed in 0.072047 second(s), 14 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表