最新单片机设计实例Word格式.docx
- 文档编号:13647474
- 上传时间:2022-10-12
- 格式:DOCX
- 页数:41
- 大小:148.11KB
最新单片机设计实例Word格式.docx
《最新单片机设计实例Word格式.docx》由会员分享,可在线阅读,更多相关《最新单片机设计实例Word格式.docx(41页珍藏版)》请在冰豆网上搜索。
ORG000BH
ORG0013H
ORG001BH
ORG0023H
初始化程序;
CLEAR:
RET
主程序;
START:
ACALLCLEAR
STAR1:
MOVP3,#0FFH
JNBP3.0,FUN0
JNBP3.1,FUN1
JNBP3.2,FUN2
JNBP3.3,FUN3;
关闭按纽
JNBF0,STAR1;
曾经有键按下F0置1
FUN0:
LCALLDL10MS;
消岸抖动
JBP3.0,STAR1
WAITL0:
JNBP3.0,WAITL0;
等待键释放
SETBF0
FUN01:
LCALLFUN00
LCALLSTAR1
LJMPFUN01
FUN1:
JBP3.1,STAR1
WAITL1:
JNBP3.1,WAITL1;
FUN10:
LCALLFUN11
LJMPFUN10
FUN2:
JBP3.2,STAR1
WAITL2:
JNBP3.2,WAITL2;
FUN20:
LCALLFUN22
LJMPFUN20
FUN3:
JBP3.3,STAR1
WAITL3:
JNBP3.3,WAITL3;
CLRF0
MOVP1,#0FFH;
关显示
LJMPSTAR1
FUN00:
MOVA,#0FEH
FUN000:
MOVP1,A
LCALLDL05S
JNBACC.7,OUT
RLA
AJMPFUN000
OUT:
FUN11:
FUN111:
JZOUT
ANLA,P1
AJMPFUN111
FUN22:
MOVA,#0AAH
MOVP1,A
LCALLDL30S
CPLA
延时程序;
DL512:
MOVR2,#0FFH
LOOP1:
DJNZR2,LOOP1
DL10MS:
MOVR3,#14H
LOOP2:
LCALLDL512
DJNZR3,LOOP2
DL05S:
MOVR4,#0AH
LOOP3:
LCALLDL10MS
DJNZR4,LOOP3
DL30S:
MOVR5,#03H
LOOP4:
LCALLDL05S
DJNZR5,LOOP4
RET
AT89C2051时钟程序;
显示缓冲单元在70H—75H,70H—71H显示秒,72H—73H显示分,74H—75H显示时
时间计数单元在70H—71H(秒)、76H—77H(分)、78H—79H(时),7AH单元放熄灭符(#0AH)
计数单元采用BCD码计数,定时器T0设置为50MS溢出中断,为秒计数用,定时器T1为调整时闪烁用
P3.7为调整按钮,P1口为字符输出口,采用共阳显示管。
中断入口程序;
ORG0000H
LJMPSTART
ORG0003H
RETI
ORG000BH
LJMPINTT0
ORG0013H
RETI
ORG001BH
LJMPINTT1
ORG0023H
ORG002BH
RETI
;
START:
MOVR0,#70H
MOVR7,#0BH
MOV20H,#00H
CLEARDISP:
MOV@R0,#00H
INCR0
DJNZR7,CLEARDISP
MOV7AH,#0AH
MOVTMOD,#11H
MOVTL0,#0B0H
MOVTH0,#3CH
MOVTL1,#0B0H
MOVTH1,#3CH
SETBEA
SETBET0
SETBTR0
MOVR4,#14H
start1:
LCALLDISPLAY
JNBP3.7,SETMM1
SJMPStart1
SETMM1:
LJMPSETMM
1秒定时程序;
INTT0:
PUSHACC
PUSHPSW
CLRET0
CLRTR0
MOVA,#0B7H;
中断同步修正
ADDA,TL0
MOVTL0,A
MOVA,#3CH
ADDA,TH0
MOVTH0,A
DJNZR4,OUTT0
ADDSS:
MOVR0,#71H
ACALLADD1;
加1程序
MOVA,R3
CLRC
CJNEA,#60H,ADDMM
ADDMM:
JCOUTT0
ACALLCLR0
MOVR0,#77H
ACALLADD1
CJNEA,#60H,ADDHH
ADDHH:
MOVR0,#79H
CJNEA,#24H,HOUR
HOUR:
OUTT0:
MOV72H,76H
MOV73H,77H
MOV74H,78H
MOV75H,79H
POPPSW
POPACC
闪动调时程序;
INTT1:
DJNZR2,INTT1OUT
MOVR2,#06H
CPL02H
JB02H,FLASH1
INTT1OUT:
FLASH1:
JB01H,FLASH2
MOV72H,7AH
MOV73H,7AH
AJMPINTT1OUT
FLASH2:
MOV74H,7AH
MOV75H,7AH
加1程序;
ADD1:
MOVA,@R0
DECR0
SWAPA
ORLA,@R0
ADDA,#01H
DAA
MOVR3,A
ANLA,#0FH
MOV@R0,A
清零程序;
CLR0:
CLRA
时钟调整程序;
SETMM:
cLRET0
LCALLDL1S
JBP3.7,CLOSEDIS
SETBET1
SETBTR1
SET2:
JNBP3.7,SET1
SETB00H
SET4:
JBP3.7,SET3
JNBP3.7,SETHH
MOVR0,#77H;
加1分程序
LCALLADD1
CJNEA,#60H,HHH
HHH:
JCSET4
LCALLCLR0
AJMPSET4
CLOSEDIS:
CLOSE:
JBP3.7,CLOSE
WAITH:
JNBP3.7,WAITH
LJMPSTART1
SETHH:
CLR00H
SETHH1:
JNBP3.7,SET5
SETB01H
SET6:
JBP3.7
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 单片机 设计 实例