单片机学号显示.docx
- 文档编号:5692528
- 上传时间:2022-12-31
- 格式:DOCX
- 页数:13
- 大小:63.01KB
单片机学号显示.docx
《单片机学号显示.docx》由会员分享,可在线阅读,更多相关《单片机学号显示.docx(13页珍藏版)》请在冰豆网上搜索。
单片机学号显示
学号显示
ORG0000H
MOVSP,#30H
MOVR0,#77H
MOV@R0,#05H
INCR0
MOV@R0,#01H
INCR0
MOV@R0,#11H
INCR0
MOV@R0,#03H
INCR0
MOV@R0,#00H
INCR0
MOV@R0,#11H
INCR0
MOV@R0,#08H
INCR0
MOV@R0,#00H
DLR:
MOVR0,#7EH
MOVR3,#01H
LD0:
MOVP2,R3
MOVA,@R0
MOVDPTR,#DSEG1
MOVCA,@A+DPTR
MOVP0,A
ACALLDELAY
DECR0
MOVA,R3
JBACC.7,DLR
RLA
MOVR3,A
AJMPLD0
DSEG1:
DB0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H,88H,83H,0C6H,0A1H,86H,8EH,0FFH,077H
DELAY:
MOVR6,#0AH
LOOP1:
MOVR4,#64H
LOOP2:
NOP
NOP
NOP
DJNZR4,LOOP2
DJNZR6,LOOP1
RET
END
开关控制50MS方波
ORG0000H
AJMPMAIN
ORG0003H
AJMPLOOP1
MAIN:
MOVTCON,#01H
SETBEA
SETBET0
MOVSP,#30H
LOOP2:
JNBP1.0,LOOP
SJMPLOOP2
LOOP:
MOVTMOD,#01H
MOVTH0,#0CFH
MOVTL0,#2CH
SETBTR0
LOOP3:
JNBP1.1,LOOP5
JBCTF0,LOOP4
AJMPLOOP3
LOOP4:
MOVTH0,#0CFH
MOVTL0,#2CH
CPLP1.2
AJMPLOOP3
LOOP5:
SETBIE0
LOOP1:
CLRP1.2
LOOP6:
JNBP1.0,LOOP
SJMPLOOP6
END
双按键控制50MS方波
ORG0000H
MOVSP,#30H
LOOP2:
JNBP1.0,LOOP
SJMPLOOP2
LOOP:
MOVTMOD,#01H
MOVTH0,#0CFH
MOVTL0,#2CH
LO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OOP3
LOOP4:
CPLP1.2
AJMPLOOP6
LOOP5:
CLRP1.2
CLRC
LCALLFH
LCALLDELAY
SJMP$
FH:
RETI
DELAY:
MOVR6,#0AH
LOOP7:
MOVR4,#64H
LOOP8:
NOP
NOP
NOP
DJNZR4,LOOP8
DJNZR6,LOOP7
RET
END
8255的PC口上4按键4数码管
ORG0000H
MOVSP,#30H
MOVDPTR,#8003H
MOVA,#81H
MOVX@DPTR,A
KEY:
ACALLKS
JNZLK1
ACALLDELAY
AJMPKEY
LK1:
ACALLDELAY
ACALLDELAY
ACALLKS
JNZLK2
ACALLDELAY
AJMPKEY
LK2:
MOVDPTR,#8002H
MOVXA,@DPTR
JNBACC.0,LOOP0
JNBACC.1,LOOP1
JNBACC.2,LOOP2
JNBACC.3,LOOP3
AJMPKEY
LOOP0:
MOVDPTR,#8002H
MOVA,#10H
MOVX@DPTR,A
AJMPKEY
LOOP1:
MOVDPTR,#8002H
MOVA,#20H
MOVX@DPTR,A
AJMPKEY
LOOP2:
MOVDPTR,#8002H
MOVA,#40H
MOVX@DPTR,A
AJMPKEY
LOOP3:
MOVDPTR,#8002H
MOVA,#80H
MOVX@DPTR,A
AJMPKEY
KS:
MOVDPTR,#8002H
MOVXA,@DPTR
CPLA
ANLA,#0FH
RET
DELAY:
MOVR6,#0AH
LOOP7:
MOVR4,#64H
LOOP8:
NOP
NOP
NOP
DJNZR4,LOOP8
DJNZR6,LOOP7
RET
END
8255的PA口上输出500us方波
ORG0000H
MOVSP,#30H
MOVDPTR,#8003H
MOVA,#81H
MOVX@DPTR,A
MOVTMOD,#10H
CLRET1
LOOP2:
MOVTH1,#0FFH
MOVTL1,#90H
SETBTR1
LOOP:
JBCTF1,LOOP1
AJMPLOOP
LOOP1:
MOVDPTR,#8000H
MOVA,#01H
MOVX@DPTR,A
AJMPLOOP3
LOOP3:
MOVTH1,#0FFH
MOVTL1,#90H
SETBTR1
LOOP4:
JBCTF1,LOOP5
AJMPLOOP4
LOOP5:
MOVDPTR,#8000H
MOVA,#00H
MOVX@DPTR,A
AJMPLOOP2
END
8255置位与复位应用
ORG0000H
MOVSP,#30H
MOVDPTR,#8003H
MOVA,#80H
MOVX@DPTR,A
LOOP1:
MOVDPTR,#8003H
MOVA,#01H
MOVX@DPTR,A
ACALLDELAY
MOVA,#03H
MOVX@DPTR,A
ACALLDELAY
MOVA,#05H
MOVX@DPTR,A
ACALLDELAY
MOVA,#07H
MOVX@DPTR,A
ACALLDELAY
MOVA,#09H
MOVX@DPTR,A
ACALLDELAY
MOVA,#0BH
MOVX@DPTR,A
ACALLDELAY
MOVA,#0DH
MOVX@DPTR,A
ACALLDELAY
MOVA,#0FH
MOVX@DPTR,A
ACALLDELAY
MOVA,#0EH
MOVX@DPTR,A
ACALLDELAY
MOVA,#0CH
MOVX@DPTR,A
ACALLDELAY
MOVA,#0AH
MOVX@DPTR,A
ACALLDELAY
MOVA,#08H
MOVX@DPTR,A
ACALLDELAY
MOVA,#06H
MOVX@DPTR,A
ACALLDELAY
MOVA,#04H
MOVX@DPTR,A
ACALLDELAY
MOVA,#02H
MOVX@DPTR,A
ACALLDELAY
MOVA,#00H
MOVX@DPTR,A
ACALLDELAY
LJMPLOOP1
DELAY:
MOVR6,#64H
LOOP6:
MOVR5,#0AH
LOOP7:
MOVR4,#64H
LOOP8:
NOP
NOP
NOP
DJNZR4,LOOP8
DJNZR5,LOOP7
DJNZR6,LOOP6
RET
END
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 单片机 学号 显示
![提示](https://static.bdocx.com/images/bang_tan.gif)