完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
本帖最后由 JoanJett 于 2017-6-12 17:14 编辑 基于51单片机设计的电子时钟 进行proteus仿真后可以实现调时功能可是led显示不出数字! 连线应该没有问题 可能是程序的问题 源程序: SCLKEQU P3.2 IO EQU P3.3 RST EQU P3.4 JIA1 EQU P3.6 TSH EQU P3.7 HOUR DATA 62H MINTUE DATA 61H SECOND DATA 60H DS1302_ADDR DATA 32H DS1302_DATA DATA 31H ORG 00H MOV SP,#70H LCALL DELY1 MOV DS1302_ADDR,#8EH MOV DS1302_DATA,#00H LCALL WRITE MOV DS1302_ADDR,#81H LCALL READ ANL A,#7FH MOV DS1302_ADDR,#80H MOV DS1302_DATA,A LCALL WRITE MOV 20H,#0 MOV 21H,#0FH MAIN1: JBTSH,MAIN2F MOV DS1302_ADDR,#81H LCALL READ ORL A,#80H MOV DS1302_ADDR,#80H MOV DS1302_DATA,A LCALL WRITE SSS: LCALLDISP JNB TSH,SSS MOV 20H,#8 SSS3: JNBTSH,FFF LCALL DISP JB JIA1,SSS3 SSS2: LCALLDISP JNB JIA1,SSS2 MOV R7,HOUR LCALL JIAYI MOV HOUR,A CJNE A,#24H,SSS1 MOV HOUR,#0 SSS1: MOVDS1302_ADDR,#84H MOV DS1302_DATA,HOUR LCALL WRITE MOV R0,HOUR LCALL DIVIDE MOV 44H,R1 MOV 45H,R2 SJMP SSS MAIN2F: LJMPMAIN2 FFF: NOP LCALL DISP JNB TSH,FFF MOV 20H,#4 FFF3: JNBTSH,MMM LCALL DISP JB JIA1,FFF3 FFF2: LCALLDISP JNB JIA1,FFF2 MOV R7,MINTUE LCALL JIAYI MOV MINTUE,A CJNE A,#60H,FFF1 MOV MINTUE,#0 FFF1: MOVDS1302_ADDR,#82H MOV DS1302_DATA,MINTUE LCALL WRITE MOV R0,MINTUE LCALL DIVIDE MOV 42H,R1 MOV 43H,R2 SJMP FFF3 MMM: LCALLDISP JNB TSH,MMM MOV 20H,#2 MMM3: JNBTSH,MAIN3 LCALL DISP JB JIA1,MMM3 MMM2: LCALLDISP JNB JIA1,MMM2 MOV R7,SECOND LCALL JIAYI MOV SECOND,A CJNE A,#60H,MMM1 MOV SECOND,#0 MMM1: ORLSECOND,#80H MOV DS1302_ADDR,#80H MOV DS1302_DATA,SECOND LCALL WRITE ANL SECOND,#7FH MOV R0,SECOND LCALL DIVIDE MOV 40H,R1 MOV 41H,R2 SJMP MMM3 MAIN3: LCALLDISP JNB TSH,MAIN3 LCALL DISP JNB TSH,MAIN3 MOV 20H,#0 MOV 21H,#0FH MOV DS1302_ADDR,#81H LCALL READ ANL A,#7FH MOV DS1302_ADDR,#80H MOV DS1302_DATA,A LCALL WRITE LJMP MAIN1 MAIN2: MOVP1,#0 MOV DS1302_ADDR,#85H LCALL READ MOV HOUR,DS1302_DATA MOV DS1302_ADDR,#83H LCALL READ MOV MINTUE,DS1302_DATA MOV DS1302_ADDR,#81H LCALL READ MOV SECOND,DS1302_DATA MOV R0,HOUR LCALL DIVIDE MOV 44H,R1 MOV 45H,R2 MOV R0,MINTUE LCALL DIVIDE MOV 42H,R1 MOV 43H,R2 MOV R0,SECOND LCALL DIVIDE MOV 40H,R1 MOV 41H,R2 LCALL DISP LJMP MAIN1 DISP: NOP JNB 01H,MIAOL MOV A,21H RL A MOV 21H,A CJNE A,#78H,MIAO1 MIAO1: JCMIAOL SETB P2.4 SETB P2.5 LJMP FEN MIAOL: MOV A,40H MOV B,#08H MUL AB MOV 3BH,A MOV R3,#0FEH MOV R5,#08H LOOP0: MOVA,3BH MOV DPTR,#TABE MOVC A,@A+DPTR MOV P0,R3 MOV P1,A MOV P2,#0DFH LCALL DELY2 INC 3BH MOV A,R3 RL A MOV R3,A DJNZ R5,LOOP0 SETB P2.5 MOV A,41H MOV B,#08H MUL AB MOV 3BH,A MOV R3,#0FEH MOV R5,#08H LOOP1: MOVA,3BH MOV DPTR,#TABE MOVC A,@A+DPTR MOV P0,R3 MOV P1,A MOV P2,#0EFH LCALL DELY2 INC 3BH MOV A,R3 RL A MOV R3,A DJNZ R5,LOOP1 SETB P2.4 FEN: JNB02H,FENL MOV A,21H RL A MOV 21H,A CJNE A,#78H,FEN1 FEN1: JCFENL SETB P2.2 SETB P2.3 SJMP SHI FENL: MOV A,42H MOV B,#08H MUL AB MOV 3BH,A MOV R3,#0FEH MOV R5,#08H LOOP2: MOVA,3BH MOV DPTR,#TABE MOVC A,@A+DPTR MOV P0,R3 MOV P1,A MOV P2,#0F7H LCALL DELY2 INC 3BH MOV A,R3 RL A MOV R3,A DJNZ R5,LOOP2 SETB P2.3 MOV A,43H MOV B,#08H MUL AB MOV 3BH,A MOV R3,#0FEH MOV R5,#08H LOOP3: MOVA,3BH MOV DPTR,#TABE MOVC A,@A+DPTR INC 3BH MOV P0,R3 MOV P1,A MOV P2,#0FBH LCALL DELY2 MOV A,R3 RL A MOV R3,A DJNZ R5,LOOP3 SETB P2.2 SHI: JNB 03H,SHIL MOV A,21H RL A MOV 21H,A CJNE A,#78H,SHI1 SHI1: JCSHIL SJMP SHI2 SHIL: MOVA,44H MOV B,#08H MUL AB MOV 3BH,A MOV R3,#0FEH MOV R5,#08H LOOP4: MOVA,3BH MOV DPTR,#TABE MOVC A,@A+DPTR MOV P0,R3 MOV P1,A MOV P2,#0FDH LCALL DELY2 INC 3BH MOV A,R3 RL A MOV R3,A DJNZ R5,LOOP4 SETB P2.1 MOV A,45H MOV B,#08H MUL AB MOV 3BH,A MOV R3,#0FEH MOV R5,#08H LOOP5: MOVA,3BH MOV DPTR,#TABE MOVC A,@A+DPTR MOV P0,R3 MOV P1,A MOV P2,#0FEH LCALL DELY2 INC 3BH MOV A,R3 RL A MOV R3,A DJNZ R5,LOOP5 SETB P2.0 SJMP SFM SHI2: SETBP2.0 SETB P2.1 SFM: RET DELY1: MOVR7,#5 DELY11: MOVR6,#0 DJNZ R6,$ DJNZ R7,DELY11 RET DELY2: MOVR7,#1 DELY21: MOVR6,#0A0H DJNZ R6,$ DJNZ R7,DELY21 RET DELY3: MOVR7,#40 DELY31: MOVR6,#0 DJNZ R6,$ DJNZ R7,DELY31 RET JIAYI: MOVA,R7 ADD A,#1 DA A RET DIVIDE: MOVA,R0 ANL A,#0FH MOV R1,A MOV A,R0 SWAP A ANL A,#0FH MOV R2,A RET WRITE: CLRSCLK SETB RST MOV A,DS1302_ADDR MOV R4,#8 WRITE1: RRCA CLR SCLK MOV IO,C SETB SCLK DJNZ R4,WRITE1 CLR SCLK MOV A, DS1302_DATA MOV R4,#8 WRITE2: RRCA CLR SCLK MOV IO,C SETB SCLK DJNZ R4,WRITE2 CLR RST RET READ: CLRSCLK SETB RST MOV A, DS1302_ADDR MOV R4,#8 READ1: RRCA NOP MOV IO,C SETB SCLK CLR SCLK DJNZ R4,READ1 MOV R4,#8 READ2: CLRSCLK MOV C,IO RRC A SETB SCLK DJNZ R4,READ2 MOV DS1302_DATA,A CLR RST RET TABE: DB 00H,18H,24H,24H,24H,24H,18H,00H DB 00H,10H,30H,10H,10H,10H,38H,00H DB00H,18H,24H,04H,18H,20H,3CH,00H DB00H,18H,24H,18H,04H,24H,18H,00H DB00H,08H,18H,28H,7CH,08H,08H,00H DB00H,1CH,10H,18H,04H,24H,18H,00H DB00H,18H,24H,38H,24H,24H,18H,00H DB00H,3CH,28H,08H,10H,10H,10H,00H DB00H,18H,24H,18H,24H,24H,18H,00H DB00H,18H,24H,24H,1CH,24H,18H,00H END 感谢各位大神!!! |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
4452 浏览 3 评论
5742 浏览 1 评论
6016 浏览 0 评论
Protues中自己封装的芯片元件无Program File、Clock Frequency选项怎么解决,求求大神了!
7750 浏览 1 评论
基于51单片机的车辆倒车雷达报警系统,HC-SR04超声波测距,全套资料
1222 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 18:31 , Processed in 0.548362 second(s), Total 73, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号