桂电智能仪器实验代码lab8000平台汇编

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

实验1

ORG 0000H

AJMP MAIN

ORG 0200H

BUFF EQU 60H

MAIN:MOV R3,#00H

MOV R4,#00H

ACALL DISPLAY

ACALL KEXAM

JZ MAIN

ACALL D10ms

ACALL KEXAM

JZ MAIN

MOV R2,#0DFH

MOV DPTR,#8004H

MOV A,#00H

MOVX @DPTR,A KEY1:MOV DPTR,#8002H MOV A,R2

MOVX @DPTR,A

MOV DPTR,#8001H

MOVX A,@DPTR

CPL A

ANL A,#0FH

JNZ KEY2

MOV A,R3

ADD A,#04H

MOV R3,A

MOV A,R2

RR A

MOV R2,A

JB ACC.0,KEY1

AJMP MAIN

KEY2:CPL A

KEY3:RRC A

JNC KEY4

INC R4

AJMP KEY3

KEY4:ACALL DISPLAY

ACALL D10ms

ACALL KEXAM

JNZ KEY4

MOV A,R3

ADD A,R4

MOV BUFF,A

KEND:AJMP MAIN

KEXAM:MOV DPTR,#8002H

MOV A,#00H

MOVX @DPTR,A

MOV DPTR,#8001H

MOVX A,@DPTR

CPL A

ANL A,#0FH

RET

DISPLAY:MOV DPTR,#TAB

MOV A,60H

MOVC A,@A+DPTR

MOV DPTR,#8004H

MOVX @DPTR,A

MOV DPTR,#8002H

MOV A,#10H

MOVX @DPTR,A

RET

D10ms:MOV R5,#30H

DL:MOV R6,#0FFH

DL0:DJNZ R6,DL0

DJNZ R5,DL

RET

TAB:DB 3FH 06H 66H 07H

DB 71H 5BH 6DH 7FH

DB 79H 4FH 7DH 6FH

DB 5EH 39H 7CH 77H

实验2

ORG 0000H

AJMP MAIN

ORG 0100H

MAIN: ACALL KEXAM ;检查按键

JZ MAIN ;无继续

ACALL D10ms ;延时去抖

ACALL KEXAM

JZ MAIN

START: MOV DPTR,#8002H ;键值分析及选通道MOV A,#0DFH

MOVX @DPTR,A

MOV DPTR,#8001H

MOVX A,@DPTR

CPL A

ANL A,#07H

CJNE A,#01H,KEY1 ;INT0

AJMP INT0

KEY1: CJNE A,#02H,KEY2;INT1

AJMP INT1

KEY2: CJNE A,#04H,MAIN

AJMP AUTO

INT0: ACALL DISPLAY1

MOV A,#0FH ;0-5V

MOV DPTR,#9000H

MOV R0,#40H

MOVX @DPTR,A

ACALL D10ms

MOVX A,@DPTR

MOV @R0,A

ACALL CAI

ACALL DISPLAY

ACALL KEXAM

JZ INT0

AJMP START

INT1: ACALL DISPLAY2

MOV A,#0FH ;固定值

MOV DPTR,#9001H

MOV R0,#40H

MOVX @DPTR,A

ACALL D10ms

MOVX A,@DPTR

MOV @R0,A

ACALL CAI

ACALL DISPLAY

ACALL KEXAM

JZ INT1

AJMP START

AUTO: MOV 50H,#2000000

LOP0:ACALL D10ms

DJNZ 50H,LOP0

AJMP INT00

AUTO1: MOV 51H,#2000000

LOP1:ACALL D10ms

DJNZ 51H,LOP1

AJMP INT11

INT00:

ACALL DISPLAY1

MOV A,#0FH ;0-5V

MOV DPTR,#9000H

MOV R0,#40H

MOVX @DPTR,A

ACALL D10ms

MOVX A,@DPTR

MOV @R0,A

ACALL CAI

ACALL DISPLAY

ACALL D10ms

MOV 53H,#30

PPP: ACALL DISPLAY1

ACALL DISPLAY

ACALL DISPLAY1

ACALL DISPLAY

ACALL DISPLAY1

ACALL DISPLAY

DJNZ 53H,PPP

ACALL KEXAM

JZ AUTO1

AJMP START

INT11:

ACALL DISPLAY2

MOV A,#0FH ;固定值

MOV DPTR,#9001H

MOV R0,#40H

MOVX @DPTR,A

ACALL D10ms

MOVX A,@DPTR

MOV @R0,A

ACALL CAI

ACALL DISPLAY

ACALL D10ms

MOV 54H,#30

OOO: ACALL DISPLAY2

ACALL DISPLAY

ACALL DISPLAY2

ACALL DISPLAY

相关文档
最新文档