DATB1 EQU 27 ;乘 0.54
DATB EQU 50 ;除
PPPP EQU 85 ;想少数响要增大数值
ADADH EQU 0FB00H ;AD地址
DAADH EQU 0F700H ;DA地址
DBUFH EQU 3CH ;DA高四位
DBUFL EQU 3DH ;DA低八位
LENG1 EQU 24 ;双字节二进制变BCD,40H~44H
LENG2 EQU 4
LENG3 EQU 3
NUMB1 EQU 40H
NUMB2 EQU 43H
ORG 0000H
AJMP MAIN
ORG 000BH
AJMP LED
ORG 0013H
AJMP KEYSCAN
MAIN: CLR P1.1
SETB P1.1
CLR P1.1
MOV R0,#00H
MOV R1,#00H
MOV SP,#50H
SETB PT0
MOV TMOD,#01H
MOV TH0,#0F8H ;2MS,显示扫描间隔
MOV TL0,#30H
SETB EA
SETB ET0
SETB TR0
SETB IT1
SETB EX1
CLR 00H ;电流千位合法位
CLR 01H ;显示闪烁
MOV 3EH,#00H ;显示数据
MOV 3FH,#00H
MOV 39H,#00H ;合字暂存
MOV 3CH,#00H
MOV 3DH,#00H
MOV 45H,#00H ;拆字暂存
SETB P1.0 ;过载
MOV DPTR,#PORT ;AB出C口入
MOV A,#03H
MOVX @DPTR,A
MOV DPTR,#PORTA ;列扫描输出低电平
MOV A,#0H
MOVX @DPTR,A
MOV 3AH,#00H
MOV 3BH,#00H
MOV 30H,#0
MOV 31H,#0
MOV 32H,#0
MOV 33H,#0
MOV 34H,#0
MOV 35H,#0
MOV 36H,#0
MOV 37H,#0
MOV WEI,#00H
SETB RS0
SETB RS1
MOV R0,#DISP0 ;显示指针 一定要用俩组
MOV R6,#8 ;显示位数
MOV R1,#DISP0 ;键盘指针
MOV R7,#4 ;键盘位数
CLR RS0
CLR RS1
LOOP: ACALL LOOPP
ACALL DTOA
ACALL ATOD
AJMP LOOP
;******************电流设置子程序***************
LOOPP: MOV A,3AH
CJNE A,#15,PASS1
ACALL SETONE
PASS1: CJNE A,#10,PASS2
ACALL JIA
PASS2: CJNE A,#11,PASS3
ACALL JIAN
PASS3:
RET
******************DA转换子程序*****************
DTOA: PUSH PSW
SETB RS0
MOV R2,3CH
MOV R3,3DH
;MOV R2,#00H
;MOV R3,#00H
CLR P3.5
SETB P3.5
SETB P2.3
CLR C
CLR A
MOV A,R2
MOV R7,#4
LOOP11: RLC A
DJNZ R7,LOOP11
MOV R7,#4
LOOP22: LCALL PRD
DJNZ R7,LOOP22
CLR C
CLR A
MOV A,R3
MOV R7,#8
LOOP34: LCALL PRD
DJNZ R7,LOOP34
CPL P2.3
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页