永发信息网

高分!!求一个单片机闹钟程序

答案:3  悬赏:20  手机版
解决时间 2021-07-19 21:27
  • 提问者网友:斑駁影
  • 2021-07-19 02:24

我现在有个stc 52的单片机还有一个学习版,想做一个定时闹钟,就是能用键盘操作led屏幕设置倒计时,分别对应时分秒,当全部归零以后闹钟就叫了,我是初学者,希望那个高手能给我一个现成的程序,越详细越好,感激不尽啊!我把针脚图穿上来,我的qq是249127162,最好直接加我qq吧。。。我把针脚图的pdf也给你。。在线等。。。

另外,我还有个现成的程序。。。但是好像不太对。。如果能帮我改对那也把分给你啦~~

最佳答案
  • 五星知识达人网友:由着我着迷
  • 2021-07-19 02:32

我帮你看看。。。改一下。。

全部回答
  • 1楼网友:怀裏藏嬌
  • 2021-07-19 03:56

org 0000h ajmp start org 0003h ajmp iint0 org 0100h start: mov b,#0ffh setb ea setb ex0 clr it0 main:mov r6,#00h mov r5,#00h mov r4,#00h mov r3,#00h mov r2,#00h mov r1,#00h main1:lcall xianshi

cjne r6,30h,lr34 lr31:cjne r5,32h,lr34 lr32:cjne r4,34h,lr34 lr33:cjne r3,#36h,lr34 lcall ring lr34: cjne r1,#9,main2 mov r1,#00h inc r2 cjne r2,#6,main3 mov r2,#00h inc r3 cjne r3,#10,main4 mov r3,#00h inc r4 cjne r4,#6,main5 mov r4,#00h inc r5 cjne r6,#2,main6 cjne r5,#4,main6 ajmp main main2:inc r1 ajmp main1 main4:ajmp main1 main5:ajmp main1 main6:cjne r5,#10,main1 mov r5,#00h inc r6 main3:ajmp main1

;中断调时 iint0:call delay jnb p3.2,zhongjian call delay call xianshi call delay pan:ljmp jieshu hui:jb p0.1,io call delay pan1:ajmp jieshu1 hui1:jb p0.1,ii call delay pan2:jnb p3.2,zhongjian jb p0.1,ia call delay pan3:jnb p3.2,zhongjian ljmp over

;中断显示 ib:jb p0.2,pan3 call delay inc r6 cjne r6,#3,ib1 mov r6,#00h call xianshi cjne r5,#4,lr ajmp ib2 lr:cjne r5,#5,lr1 ajmp ib2 lr1:cjne r5,#6,lr2 ajmp ib2 lr2:cjne r5,#7,lr3 ajmp ib2 lr3:cjne r5,#8,lr4 ajmp ib2 lr4:cjne r5,#9,pan3

ib2:mov r5,#3 ajmp pan3 ia2:cjne r5,#3,ia1 mov r5,#00h call xianshi ajmp pan2 zhongjian:sjmp jie zhongjian2:sjmp ib ia:jb p0.2,pan2 call delay cjne r6,#0,ia2 sjmp loop cjne r6,#1,ia2 loop:cjne r5,#10,ia1 mov r5,#00h ajmp pan2

ii:jb p0.2,pan1 call delay cjne r4,#5,ii1 mov r4,#00h ajmp pan1 io:jb p0.2,pan call delay cjne r3,#9,io1 mov r3,#00h ajmp pan

io1:inc r3 call xianshi ajmp pan ii1:inc r4 call xianshi call xianshi ajmp pan1 ia1:inc r5 call xianshi ajmp pan2 ib1:call xianshi call xianshi ajmp pan3 jieshu:jnb p3.2,jie ajmp hui jieshu1:jnb p3.2,jie ajmp hui1 over:jb p0.1,zhongjian2 call delay jie:call delay ;调节闹铃 jnb p3.2,zhongjian2 call delay call daojing

reti daojing: mov 30h,#12 mov 32h,#00 mov 34h,#00 mov 36h,#00 call xianshi call delay pan2:ljmp jieshu2 hui2:jb p0.1,io2 call delay pan21:ajmp jieshu21 hui21:jb p0.1,ii2 call delay pan22:jnb p3.2,zhongjian3 jb p0.1,ia2 call delay pan23:jnb p3.2,zhongjian3 ljmp over2 ib2:jb p0.2,pan23 call delay inc 30h cjne 30h,#3,ib21 mov 30h,#00h call xianshi cjne 32h,#4,lr2 ajmp ib22 lr2:cjne 32h,#5,lr21 ajmp ib22 lr21:cjne 34h,#6,lr22 ajmp ib22 lr22:cjne 32h,#7,lr23 ajmp ib22 lr23:cjne 32h,#8,lr24 ajmp ib22 lr24:cjne 32h,#9,pan23

ib22:mov 32h,#3 ajmp pan23 ia22:cjne 32h,#3,ia21 mov r5,#00h call xianshi ajmp pan22 zhongjian3:sjmp jiejie zhongjian22:sjmp ib2 ia2:jb p0.2,pan22 call delay cjne 30h,#0,ia22 sjmp loop2 cjne 30h,#1,ia22 loop2:cjne 32h,#10,ia21 mov 32h,#00h ajmp pan22

ii2:jb p0.2,pan21 call delay cjne r4,#5,ii21 mov 34h,#00h ajmp pan21 io2:jb p0.2,pan2 call delay cjne 36h,#9,io21 mov 36h,#00h ajmp pan2 io21:inc 36h call xianshi ajmp pan2 ii21:inc 34h call xianshi ajmp pan21 ia21:inc 32h call xianshi ajmp pan22 ib21:call xianshi call xianshi ajmp pan23 jieshu2:jnb p3.2,jiejie ajmp hui2 jieshu21:jnb p3.2,jiejie ajmp hui21 over2:jb p0.1,zhongjian22 call delay jiejie: call delay ret xianshi: clr p2.3 mov a,r1 anl a,#0fh call xianshi2 call del3 setb p2.3

clr p2.2 mov a,r2 anl a,#0fh call xianshi2 call del3 setb p2.2 clr p2.1 mov p1,#40h call del3 setb p2.1 clr p2.0 mov a,r3 anl a,#0fh call xianshi2 call del3 setb p2.0 setb p2.7 mov a,r4 anl a,#0fh call xianshi1 call del3 clr p2.7 setb p2.6 mov p1,#0bfh call del3 clr p2.6 setb p2.5 mov a,r5 anl a,#0fh call xianshi1 call del3 clr p2.5 setb p2.4 mov a,r6 anl a,#0fh call xianshi1 call del3 clr p2.4 djnz b,xianshi mov b,#0ffh ret xianshi1:mov dptr,#sgtb1 movc a,@a+dptr mov p1,a ret xianshi2:mov dptr,#sgtb2 movc a,@a+dptr mov p1,a ret delay:mov 60h,#10 delay2:mov r0,#20 delay1:mov r7,#123 djnz r7,$ djnz r0,delay1 djnz 60h,delay2 ret del:mov 62h,#20 del2:mov 64h,#200 del1:mov 66h,#123 djnz 66h,$ djnz 64h,del1 djnz 62h,del2 ret del3: mov 70h,#250 NOP Del31: DJNZ 70h,DEL31 RET ring: mov 50h,#12 cpl p0.3 djnz 50h,ring mov 50h,#12 ret sgtb1:db 0c0h ;0 db 0f9h ;1 db 0a4h ;2 db 0b0h ;3 db 99h ;4 db 92h ;5 db 82h ;6 db 0f8h ;7 db 80h ;8 db 90h ;9 sgtb2:db 3fh ;0 db 06h ;1 db 5bh ;2 db 4fh ;3 db 66h ;4 db 6dh ;5 db 7dh ;6 db 07h ;7 db 7fh ;8 db 6fh ;9 db 77h ;灭 end

  • 2楼网友:山君与见山
  • 2021-07-19 03:02

汇编不想写!帮你改吧。把原理图和程序发过来!就加我这个QQ就行了

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯