桂电智能仪器实验代码最新lab8000平台汇编.docx
《桂电智能仪器实验代码最新lab8000平台汇编.docx》由会员分享,可在线阅读,更多相关《桂电智能仪器实验代码最新lab8000平台汇编.docx(29页珍藏版)》请在冰豆网上搜索。
![桂电智能仪器实验代码最新lab8000平台汇编.docx](https://file1.bdocx.com/fileroot1/2022-11/23/c21c1d8a-545c-4652-90a8-1763004dca1a/c21c1d8a-545c-4652-90a8-1763004dca1a1.gif)
桂电智能仪器实验代码最新lab8000平台汇编
实验1
ORG0000H
AJMPMAIN
ORG0200H
BUFFEQU60H
MAIN:
MOVR3,#00H
MOVR4,#00H
ACALLDISPLAY
ACALLKEXAM
JZMAIN
ACALLD10ms
ACALLKEXAM
JZMAIN
MOVR2,#0DFH
MOVDPTR,#8004H
MOVA,#00H
MOVX@DPTR,A
KEY1:
MOVDPTR,#8002H
MOVA,R2
MOVX@DPTR,A
MOVDPTR,#8001H
MOVXA,@DPTR
CPLA
ANLA,#0FH
JNZKEY2
MOVA,R3
ADDA,#04H
MOVR3,A
MOVA,R2
RRA
MOVR2,A
JB,KEY1
AJMPMAIN
KEY2:
CPLA
KEY3:
RRCA
JNCKEY4
INCR4
AJMPKEY3
KEY4:
ACALLDISPLAY
ACALLD10ms
ACALLKEXAM
JNZKEY4
MOVA,R3
ADDA,R4
MOVBUFF,A
KEND:
AJMPMAIN
KEXAM:
MOVDPTR,#8002H
MOVA,#00H
MOVX@DPTR,A
MOVDPTR,#8001H
MOVXA,@DPTR
CPLA
ANLA,#0FH
RET
DISPLAY:
MOVDPTR,#TAB
MOVA,60H
MOVCA,@A+DPTR
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#10H
MOVX@DPTR,A
RET
D10ms:
MOVR5,#30H
DL:
MOVR6,#0FFH
DL0:
DJNZR6,DL0
DJNZR5,DL
RET
TAB:
DB3FH06H66H07H
DB71H5BH6DH7FH
DB79H4FH7DH6FH
DB5EH39H7CH77H
实验2
ORG0000H
AJMPMAIN
ORG0100H
MAIN:
ACALLKEXAM;检查按键
JZMAIN;无继续
ACALLD10ms;延时去抖
ACALLKEXAM
JZMAIN
START:
MOVDPTR,#8002H;键值分析及选通道
MOVA,#0DFH
MOVX@DPTR,A
MOVDPTR,#8001H
MOVXA,@DPTR
CPLA
ANLA,#07H
CJNEA,#01H,KEY1;INT0
AJMPINT0
KEY1:
CJNEA,#02H,KEY2;INT1
AJMPINT1
KEY2:
CJNEA,#04H,MAIN
AJMPAUTO
INT0:
ACALLDISPLAY1
MOVA,#0FH;0-5V
MOVDPTR,#9000H
MOVR0,#40H
MOVX@DPTR,A
ACALLD10ms
MOVXA,@DPTR
MOV@R0,A
ACALLCAI
ACALLDISPLAY
ACALLKEXAM
JZINT0
AJMPSTART
INT1:
ACALLDISPLAY2
MOVA,#0FH;固定值
MOVDPTR,#9001H
MOVR0,#40H
MOVX@DPTR,A
ACALLD10ms
MOVXA,@DPTR
MOV@R0,A
ACALLCAI
ACALLDISPLAY
ACALLKEXAM
JZINT1
AJMPSTART
AUTO:
MOV50H,#2000000
LOP0:
ACALLD10ms
DJNZ50H,LOP0
AJMPINT00
AUTO1:
MOV51H,#2000000
LOP1:
ACALLD10ms
DJNZ51H,LOP1
AJMPINT11
INT00:
ACALLDISPLAY1
MOVA,#0FH;0-5V
MOVDPTR,#9000H
MOVR0,#40H
MOVX@DPTR,A
ACALLD10ms
MOVXA,@DPTR
MOV@R0,A
ACALLCAI
ACALLDISPLAY
ACALLD10ms
MOV53H,#30
PPP:
ACALLDISPLAY1
ACALLDISPLAY
ACALLDISPLAY1
ACALLDISPLAY
ACALLDISPLAY1
ACALLDISPLAY
DJNZ53H,PPP
ACALLKEXAM
JZAUTO1
AJMPSTART
INT11:
ACALLDISPLAY2
MOVA,#0FH;固定值
MOVDPTR,#9001H
MOVR0,#40H
MOVX@DPTR,A
ACALLD10ms
MOVXA,@DPTR
MOV@R0,A
ACALLCAI
ACALLDISPLAY
ACALLD10ms
MOV54H,#30
OOO:
ACALLDISPLAY2
ACALLDISPLAY
ACALLDISPLAY2
ACALLDISPLAY
ACALLDISPLAY2
ACALLDISPLAY
DJNZ54H,OOO
ACALLKEXAM
JZAUTO
AJMPSTART
KEXAM:
MOVDPTR,#8004H;按键判断
MOVA,#00H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#00H
MOVX@DPTR,A
MOVDPTR,#8001H
MOVXA,@DPTR
CPLA
ANLA,#0FH
RET
CAI:
MOVA,@R0;数据处理
MOVB,#51
DIVAB
MOV40H,A
MOVA,B
CLRF0
SUBBA,#1AH
MOVF0,C
MOVA,#10
MULAB
MOVB,#51
DIVAB
JBF0,LOOP2
ADDA,#5
LOOP2:
MOV41H,A
MOVA,B
MOVA,B
CLRF0
SUBBA,#1AH
MOVF0,C
MOVA,#10
MULAB
MOVB,#51
DIVAB
JBF0,LOOP3
ADDA,#5
LOOP3:
MOV42H,A
RET
DISPLAY:
MOVDPTR,#TAB;列表显示个位整数40H
MOVA,40H
MOVCA,@A+DPTR
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#10H
MOVX@DPTR,A
ACALLD10ms
MOVA,#80H;小数点
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#10H
MOVX@DPTR,A
ACALLD10ms
MOVDPTR,#TAB;余数41H42H
MOVA,41H
MOVCA,@A+DPTR
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#08H
MOVX@DPTR,A
ACALLD10ms
MOVDPTR,#TAB
MOVA,42H
MOVCA,@A+DPTR
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#04H
MOVX@DPTR,A
ACALLD10ms
RET
DISPLAY1:
MOVA,#3FH
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#20H
MOVX@DPTR,A
LCALLD10ms
RET
DISPLAY2:
MOVA,#06H
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#20H
MOVX@DPTR,A
LCALLD10ms
RET
D10ms:
MOVR5,#03H;延时10
DL:
MOVR6,#0FFH
DL0:
DJNZR6,DL0
DJNZR5,DL
RET
TAB:
DB3FH,06H,5BH,4FH
DB66H,6DH,7DH,07H
DB7FH,6FH,77H,7CH
DB39H,5EH,79H,71H
实验4
ORG0000H
AJMPKEYPR
ORG0200H
KEYPR:
MOVR3,#00H;列寄存器
MOVR4,#00H;行寄存器
ACALLKEXAM
JZKEND
ACALLD10ms
ACALLKEXAM
JZKEND
MOVR2,#0DFH;扫描初值
KEY1:
MOVDPTR,#8004H
MOVA,#00H
MOVX@DPTR,A
MOVDPTR,#8002H;送列码地址
MOVA,R2
MOVX@DPTR,A;扫描第一列
MOVDPTR,#8001H;送行码地址
MOVXA,@DPTR
CPLA
ANLA,#0FH
JNZKEY2;有键按下,求行值
MOVA,R3;无键按下,列加4
ADDA,#04H
MOVR3,A
MOVA,R2;求下一列扫描值
RRA
MOVR2,A
JB,KEY1;判断是否已全扫描
AJMPKEND
KEY2:
CPLA;恢复行模型
KEY3:
RRCA
JNCKEY4
INCR4
AJMPKEY3
KEY4:
ACALLD10ms
ACALLKEXAM
JNZKEY4
MOVA,R3
ADDA,R4
MOV60H,A;键值存入60H
L0:
CJNEA,#00H,L1
MOVDPTR,#DLTAB
MOVA,30H
CJNEA,#05,ADDF1
MOV30H,#00H
LJMPADDF2
ADDF1:
INC30H
ADDF2:
MOVCA,@A+DPTR
MOV31H,A
DLTAB:
DB01H,20H,50H,80H,0A0H
L1:
CJNEA,#0FH,L2;锯齿波
LS0:
ACALLDISPLAY
MOVDPTR,#9000H
MOVA,#00H
LS1:
MOVX@DPTR,A
INCA
ACALLDELAY
CJNEA,#0FFH,LS1
ACALLDELAY
ACALLDISPLAY
ACALLKEXAM
JZLS0
AJMPKEND
KEND:
ACALLDISPLAY
LJMPKEYPR
L2:
CJNEA,#0EH,L3;三角波
LS2:
ACALLDISPLAY
MOVDPTR,#9000H
MOVA,#00H
MOVR0,#200
LS3:
ACALLDELAY
MOVX@DPTR,A
INCA
CJNEA,#0FFH,LS3
LS4:
ACALLDELAY
DECA
MOVX@DPTR,A
CJNEA,#00H,LS4
DJNZR0,LS3
ACALLDISPLAY
ACALLKEXAM
JZLS2
AJMPKEND
L3:
CJNEA,#0DH,L4;正弦波
LS5:
ACALLDISPLAY
MOVA,#00
MOVR0,A
LS6:
MOVDPTR,#TZSB
MOVA,R0
MOVCA,@A+DPTR
MOVDPTR,#9000H
MOVX@DPTR,A
ACALLDELAY
INCR0
CJNER0,#32,LS6
ACALLDISPLAY
ACALLKEXAM
JZLS5
AJMPKEND
L4:
CJNEA,#0CH,KEND;方波
ACALLDISPLAY
MOVR0,#200
LS7:
ACALLDISPLAY
MOVA,#00
MOVDPTR,#9000H
MOVX@DPTR,A
ACALLDELAY
MOVA,#255
MOVX@DPTR,A
ACALLDELAY
DJNZR0,LS7
ACALLD10ms
ACALLDISPLAY
ACALLKEXAM
JZLS7
AJMPKEND
DISPLAY:
MOVDPTR,#TAB;显示子程序
MOVA,60H
MOVCA,@A+DPTR
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#01H
MOVX@DPTR,A
RET
D10ms:
MOVR5,#03H;延时10毫秒
DL:
MOVR6,#0FFH
DL0:
DJNZR6,DL0
DJNZR5,DL
RET
DELAY:
MOVR6,31H
DL1:
DJNZR6,DL1
RET
KEXAM:
MOVDPTR,#8002H;检查是否有键按下子程序
MOVA,#00H
MOVX@DPTR,A
MOVDPTR,#8001H
MOVXA,@DPTR
CPLA
ANLA,#0FH
RET
TAB:
DB3FH,06H,66H,07H,71H,5BH,6DH,7FH,79H,4FH,7DH,6FH,5EH,39H,7CH,77H
TZSB:
DB80H,98H,0B0H,0C6H,0DAH,0EAH,0F5H,0FDH
DB0FFH,0FDH,0F5H,0EAH,0DAH,0C6H,0B0H,98H
DB80H,68H,50H,3AH,26H,16H,0BH,03H
DB01H,03H,0BH,16H,26H,3AH,50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A
INCR6
MOV@R0,#00H
BBC2:
CLRC
MOVA,R2
SUBBA,R4
MOVR2,A
MOVA,R3
SUBBA,R5
MOVR3,A
JCBBC3
INC@R0
SJMPBBC2
BBC3:
MOVA,R2
ADDA,R4
MOVR2,A
MOVA,R3
ADDCA,R5
MOVR3,A
DECR0
DJNZR7,BBC1
MOVA,R2
MOV@R0,A
RET
PWTAB:
DB10H27H0E8H03H0E8H03H0AH00H
DISPLAY:
MOVR2,#20H;显示循环次数
MOVR0,#64H;64H为高位数据存储单元
MOVR7,#4;共2个八段管
MOVR6,#00100000B;从左边开始显示
MOVDPTR,#8002H
MOVA,#0
MOVX@DPTR,A;关所有八段管
LOOP:
MOVDPTR,#TAB
MOVA,@R0
MOVCA,@A+DPTR
CJNER0,#63H,LOPP
ORLA,#80H;第二位打小数点,单位为KHz
LOPP:
MOVDPTR,#08004H
MOVX@DPTR,A
MOVDPTR,#08002H
MOVA,R6
MOVX@DPTR,A;显示一位八段管
CALLDL10ms
MOVA,R6;显示下一位
RRA
MOVR6,A
DECR0
DJNZR7,LOOP
DJNZR2,DISPLAY
RET
DISPLAY1:
MOVDPTR,#TAB
MOVA,41H
MOVCA,@A+DPTR
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#10H
MOVX@DPTR,A
MOVA,40H
MOVCA,@A+DPTR
MOVDPTR,#8004H
MOVX@DPTR,A
MOVDPTR,#8002H
MOVA,#08H
MOVX@DPTR,A
RET
DDFF:
DB0CH,09FH,4AH,0BH,99H
DB29H,28H,8FH,08H,09H
KEXAM:
MOVDPTR,#8002H;列地址
MOVA,#00H
MOVX@DPTR,A
MOVDPTR,#8001H;行地址
MOVXA,@DPTR
CPLA
ANLA,#0FH
RET
DL10ms:
MOV11H,#30H
DL:
MOV10H,#255
DL0:
DJNZ10H,DL0
DJNZ11H,DL
RET
TAB:
DB3FH06H66H07H
DB71H5BH6DH7FH
DB79H4FH7DH6FH
DB5EH39H7CH77H
考试
ORG0000H
AJ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