资源描述:
《基于51单片机的倒计时程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、kk1bitb.1kk2bitb.2ORG0000HLJMPSTARTORG000BHLJMPCTC0TT1 EQU37H;50msTT2 EQU38H;秒TT3 EQU39H;分TT4 EQU3AH;时YUESHIEQU40HYUEFENEQU41HORG42HVIEW0:DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H DB80H,90H,88H,83H,0C6H,0A1H,86H,84HORG0A0HTEMP_TAB:DB00H,01H,02H,0
2、3H,04H,05H,06H,07H DB08H,09H,10H,11H,12H,13H,14H,15H DB16H,17H,18H,19H,20H,21H,22H,23H DB24H,25H,26H,27H,28H,29H,30H,31H DB32H,33H,34H,35H,36H,37H,38H,39H DB40H,41H,42H,43H,44H,45H,46H,47H
3、DB48H,49H,50H,51H,52H,53H,54H,55H DB56H,57H,58H,59H,60HORG 100HSTART: MOVTMOD,#01H MOVTL0,#0B0H MOVTH0,#3CH SETBEA SETBET0 SETBTR0 SETBP2.4; SETBP2.5 JBP1.6,NEXT ;JMPZHUNEXT: MOVA,#00H MOVR2,#17H
4、 ;24小时 MOVYUESHI,#00H MOVYUEFEN,#00H MOVR3,#3BH ;60 SETBKK1 SETBKK2mainline: JB P1.3,KEY1 CLRKK1KEY1: JNBp1.3,KEY2;当p1.3高电平时就往下执行,但是只要执行一次后,kk1就为1,往后就不再执行 JBKK1,KEY2 INCYUESHI SETBKK1 ;这以段的任务是不用延时也能消除按键抖
5、动的程序KEY2: JB P1.4,KEY3 CLRKK2KEY3:JNBP1.4,RES JB KK2,RES SETBKK2 INCYUEFENRES: MOVA,YUESHI SUBBA,R2 JNZBUDAOSHI MOVYUESHI,#00HBUDAOSHI: MOVA,YUEFEN SUBBA,R3 JNZBUDAOFEN MOVYUEFEN,#00HBUDAO
6、FEN: MOVA,YUESHI MOVDPTR,#TEMP_TAB MOVCA,@A+DPTR MOVR0,A ANLA,#0FH;送小时的个位 MOVDPTR,#VIEW0 MOVCA,@A+DPTR MOVP0,A SETBP2.0 SETBP2.1 CLRP2.2 SETBP2.3 LCALLDELAY MOVA,R0 SWAPA ANLA,#0FH MOVCA,@A+DPTR MOVP0,A;显示时的十位 SETBP2.0 SETBP2.1
7、 SETBP2.2 CLR P2.3 LCALLDELAY MOVA,YUEFEN MOVDPTR,#TEMP_TAB MOVCA,@A+DPTR MOVR0,A ANLA,#0FH;送分的个位 MOVDPTR,#VIEW0 MOVCA,@A+DPTR MOVP0,A CLRP2.0 SETBP2.1 SETBP2.2 SETBP2.3 LCALLDELAY MOVA,R0 SWAPA ANLA,#0FH MOVCA,@A+DPTR MOV
8、P0,A;显示分的十位 SETBP2.0 CLRP2.1 SETBP2.2 SETBP2.3 LCALLDELAY JNBP2.2,NEXT2;按下就进入定时煮饭的阶段 LJMPmainlineDELAY: MOVR5,#08H;40ms延时子程序L7: MOVR6,#0FAHL8: DJNZR6,L8 DJNZR5,L7