最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

UART

IT圈 admin 37浏览 0评论

2024年5月14日发(作者:妫晗日)

; UART命令处理程序

UartCMDPRC:

CLRB CMDCRC

NOP

LD 40H, PROPOINT

LD 42H, #7000H

L8474H:

LDB 0D0H, [40H]+

STB 0D0H, [42H]+

CMP 42H, #73FFH

JH COMerr

ADDB CMDCRC, 0D0H

CMP 40H, #7000H

JNE L848DH

LD 40H, #6800H

; 找结束标志F0

L848DH:

CMPB 0D0H, #0F0H

JNE L8474H

;

L8492H:

读CRC

LDB 0D0H, [40H]+

STB 0D0H, [42H]+

ADDB CMDCRC, 0D0H

CMP 40H, #7000H

JNE L84A5H

LD 40H, #6800H

L84A5H:

LD PROPOINT, 40H

DECB CMDCONTER

CMPB CMDCRC, #00H

JE CMDPRC

CMPB CMDCRC, #0EFH

JE CMDPRC

CMPB CMDCRC, #0EDH

JE CMDPRC

; UARTCMD错误

COMerr:

LCALL CLRUARTRAM

RET

;

CMDPRC:

命令处理

LD 40H, #7000H

LDB 0D0H, [40H]+

CMPB 0D0H, #0A0H

JNE L84CDH

LCALL rstCOUNT

RET

L84CDH:

CMPB 0D0H, #0A1H

JNE L84D6H

LCALL L857AH

RET

L84D6H:

CMPB 0D0H, #0A2H

JNE L84DFH

LCALL L8589H

RET

L84DFH:

CMPB 0D0H, #0A3H

JNE L84E8H

LCALL L859EH

RET

L84E8H:

CMPB 0D0H, #0A4H

JNE L84F1H

LCALL L85ADH

RET

L84F1H:

CMPB 0D0H, #0A5H

JNE L84FAH

LCALL L85C2H

RET

L84FAH:

CMPB 0D0H, #0A6H

JNE L8503H

LCALL L85D1H

RET

L8503H:

CMPB 0D0H, #0A7H

JNE L850CH

LCALL L85E6H

RET

L850CH:

CMPB 0D0H, #0A8H

JNE L8515H

LCALL L85F3H

RET

L8515H:

CMPB 0D0H, #0A9H

JNE L851EH

LCALL UartRST

RET

L851EH:

CMPB 0D0H, #0B0H

JNE L8527H

LCALL L8618H

RET

L8527H:

CMPB 0D0H, #0B1H

JNE L8530H

LCALL L8630H

RET

L8530H:

CMPB 0D0H, #0B2H

JNE L8539H

LCALL L864DH

RET

L8539H:

CMPB 0D0H, #0B3H

JNE L8542H

LCALL L8678H

RET

L8542H:

CMPB 0D0H, #0B4H

JNE L854BH

LCALL L86B8H

RET

L854BH:

CMPB 0D0H, #0B5H

JNE L8554H

LCALL L86C5H

RET

L8554H:

CMPB 0D0H, #0B6H

JNE L855DH

LCALL L86D2H

RET

L855DH:

CMPB 0D0H, #0B7H

JNE L8566H

LCALL L86DFH

RET

L8566H:

NOP

RET

; 计数器清除

rstCOUNT:

LDB FCOUTRST, #55H

LCALL COUNTRST

LDB 0D0H, #0A0H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L857AH:

LCALL L8720H

LDB 0D0H, #0A1H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L8589H:

LCALL L8855H

LCALL L86ECH

LCALL L8728H

LDB 0D0H, #0A2H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L859EH:

LCALL L8767H

LDB 0D0H, #0A3H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85ADH:

LCALL L8855H

LCALL L86ECH

LCALL L876FH

LDB 0D0H, #0A4H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85C2H:

LCALL L87CDH

LDB 0D0H, #0A5H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85D1H:

LCALL L8855H

LCALL L86ECH

LCALL L87D5H

LDB 0D0H, #0A6H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85E6H:

NOP

LDB 0D0H, #0A7H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85F3H:

LCALL CMDPROC

LDB 0D0H, #0A8H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

; UART复位程序

UartRST:

LDB 0D0H, #0A9H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

LD SETINDEX, #0FA0H

L8611H:

DJNZW SETINDEX, L8611H

LCALL CLRUARTRAM

RET

L8618H:

NOP

LDB 0D0H, [40H]

ANDB 0D0H, #0FH

STB 0D0H, 7B02H[00H]

LDB 0D0H, #0B0H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L8630H:

LCALL L8855H

LCALL L86F7H

LDB 0D0H, 38H

ANDB 0D0H, #0FH

STB 0D0H, 7B00H[00H]

LDB 0D0H, #0B1H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L864DH:

NOP

LD 42H, #7B10H

LDB SETINDEX, #10H

L8655H:

STB 00H, [42H]+

DJNZ SETINDEX, L8655H

LD 42H, #7B10H

LDB 0D0H, [40H]+

CMPB 0D0H, #0F0H

JE L866CH

STB 0D0H, [42H]+

SJMP 865FH

L866CH:

LDB 0D0H, #0B2H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L8678H:

LCALL L8855H

LCALL L86F7H

ST 38H, 7B20H[00H]

LCALL L8855H

LCALL L86F7H

ST 38H, 7B24H[00H]

LD 38H, 7B20H[00H]

CLR 3AH

DIVU 38H, 7B24H[00H]

MULU 38H, #000BH

DIVU 38H, #000AH

ST 38H, 7B2CH[00H]

ST 00H, 7B34H[00H]

LDB 0D0H, #0B3H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86B8H:

NOP

LDB 0D0H, #0B4H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86C5H:

NOP

LDB 0D0H, #0B5H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86D2H:

NOP

LDB 0D0H, #0B6H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86DFH:

NOP

LDB 0D0H, #0B7H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86ECH:

LCALL L86F7H

DECB 38H

STB 38H, 7B06H[00H]

RET

L86F7H:

LD 0B2H, #7A10H

LDB 30H, [0B2H]+

LDB 31H, [0B2H]+

LDB 32H, [0B2H]+

LDB 33H, [0B2H]+

LDB 34H, [0B2H]+

SHLB 31H, #04H

ORB 30H, 31H

SHLB 33H, #04H

LDB 31H, 32H

ORB 31H, 33H

LDB 32H, 34H

LCALL CBCD2BIN

RET

L8720H:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

L8728H:

LCALL L8855H

LDB SETINDEX, 7B06H[00H]

LD 42H, #6500H

MULUB SETINDEX, #08H

ADD 42H, SETINDEX

LDB SETINDEX, #08H

LD 0B2H, #7A10H

L8741H:

LDB 0D0H, [0B2H]+

STB 0D0H, [42H]+

DJNZ SETINDEX, L8741H

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L8763H

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

CMPB SETINDEX, #0FH

JNH L8728H

L8763H:

LCALL CONTSDSP

RET

L8767H:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

L876FH:

LCALL L8855H

LCALL L883EH

LDB SETINDEX, 7B06H[00H]

LD 42H, #6000H

MULUB SETINDEX, #04H

ADD 42H, SETINDEX

CMP 42H, #6104H

JE L87C9H

JH L87C9H

PUSH 40H

PUSH EDITINDEX

LDB EDITINDEX, #00H

LD 0B2H, #9F90H

LDB 38H, EDITINDEX

MULUB 38H, #02H

ADD 0B2H, 38H

LD 0D0H, [0B2H]

CMP 0D0H, 42H

JE L87ACH

INCB EDITINDEX

SJMP 8793H

L87ACH:

LCALL CHACKIN

POP EDITINDEX

POP 40H

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L87C9H

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP L876FH

L87C9H:

LCALL L8CFFH

RET

L87CDH:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

L87D5H:

LCALL L8855H

LCALL L883EH

LDB SETINDEX, 7B06H[00H]

LD 42H, #6200H

MULUB SETINDEX, #04H

ADD 42H, SETINDEX

CMP 42H, #627CH

JE L883CH

JH L883CH

PUSH 40H

PUSH EDITINDEX

LDB EDITINDEX, #00H

L87F9H:

LD 0B2H, #9F90H

LDB 38H, EDITINDEX

MULUB 38H, #02H

ADD 0B2H, 38H

LD 0D0H, [0B2H]

CMP 0D0H, 42H

JE L8817H

INCB EDITINDEX

CMPB EDITINDEX, #76H

JNE L87F9H

JE L8822H

L8817H:

LCALL CHACKIN

LDB 48H, EDITINDEX

INCB 48H

LCALL SETINGDISP

L8822H:

POP EDITINDEX

POP 40H

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L883CH

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP L87D5H

L883CH:

NOP

RET

L883EH:

LD 0B2H, #7A10H

LDB 84H, [0B2H]+

LDB 83H, [0B2H]+

LDB 82H, [0B2H]+

LDB 81H, [0B2H]+

LDB 80H, [0B2H]+

LCALL L97DCH

RET

L8855H:

LD 42H, #7A00H

L8859H:

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L886DH

INC 40H

CMPB 0D0H, #2CH

JE L886DH

STB 0D0H, [42H]+

JNE L8859H

L886DH:

DEC 42H

ST 00H, 7A10H[00H]

ST 00H, 7A12H[00H]

ST 00H, 7A14H[00H]

ST 00H, 7A16H[00H]

LD 0B2H, #7A10H

L8887H:

LDB 0D0H, [42H]

CMPB 0D0H, #2EH

JE L8892H

ANDB 0D0H, #0FH

L8892H:

STB 0D0H, [0B2H]+

DEC 42H

CMP 42H, #79FFH

JNE L8887H

RET

; 清理UART用内存

CLRUARTRAM:

NOP

CLRB CMDCONTER

CLRB CMDDATA

LD RECPOINT, #6800H

LD PROPOINT, #6800H

LDB 0D0H, SBUF

LDB 0D0H, SBUF

LD SENDPOINT1, #7400H

LD SENDPOINT2, #7400H

LD 42H, #6800H

L88BDH:

ST 00H, [42H]+

CMP 42H, #7400H

JNE L88BDH

LDB 0D0H, 00H

ORB 0D0H, #08H

STB 0D0H, 7B00H[00H]

STB 00H, 7B02H[00H]

STB 00H, RSTCMD

CLRB TRRRECIVE

RET

;

senda9&crc:

向UART发送报文为#0A9h的信息

CLRB 0BFH

LDB SENDTEMP, #0A9H

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 向UART发送报文为#0E0h,7B04H,CRC的信息

sE07B04CRC:

CLRB 0BFH

LDB SENDTEMP, #0E0H

LCALL SENDTEMP2

LDB SENDTEMP, 7B04H[00H]

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 向UART发送报文为#0E1h,7B04H,CRC的信息

sE17B04CRC:

CLRB 0BFH

LDB SENDTEMP, #0E1H

LCALL SENDTEMP2

LDB SENDTEMP, 7B04H[00H]

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 收到命令处理

CMDPROC:

NOP

LDB 0D0H, [40H]+

CMPB 0D0H, #0A1H

JNE L891DH

LCALL SENDALLCOUT

RET

L891DH:

CMPB 0D0H, #0A2H

JNE L8926H

LCALL SDTISBINCOUT

RET

L8926H:

CMPB 0D0H, #0A3H

JNE L892FH

LCALL SDP12SET

RET

L892FH:

CMPB 0D0H, #0A4H

JNE L8938H

LCALL SD1PSET

RET

L8938H:

CMPB 0D0H, #0A5H

JNE L8941H

LCALL SDP3SET

RET

L8941H:

CMPB 0D0H, #0A6H

JNE L894AH

LCALL SD3PDRV

RET

L894AH:

CMPB 0D0H, #0A7H

JNE L8953H

LCALL L8B0CH

RET

L8953H:

CMPB 0D0H, #0B0H

JNE L895CH

LCALL RESP7b02

RET

L895CH:

CMPB 0D0H, #0B1H

JNE L8965H

LCALL RESP7b00

RET

L8965H:

CMPB 0D0H, #0B2H

JNE L896EH

LCALL RESP7b10A

RET

L896EH:

CMPB 0D0H, #0B3H

JNE L8977H

LCALL RESP7b20T24

RET

L8977H:

CMPB 0D0H, #0D0H

JNE L8980H

LCALL SDD0F0CRC

RET

L8980H:

CMPB 0D0H, #0D1H

JNE L8989H

LCALL SDRSLT

RET

L8989H:

CMPB 0D0H, #0D2H

JNE L8992H

LCALL SDTIME

RET

L8992H:

CMPB 0D0H, #0E2H

JNE L899BH

LCALL L8C6EH

RET

L899BH:

CMPB 0D0H, #0E3H

JNE L89A4H

LCALL L8C70H

RET

L89A4H:

CMPB 0D0H, #0E4H

JNE L89ADH

LCALL SDID

RET

L89ADH:

NOP

RET

; 向UART发送所有BIN计数结果

SENDALLCOUT:

CLRB 0BFH

LDB SENDTEMP, #0A1H

LCALL SENDTEMP2

LD 40H, #6505H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #650DH

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #6515H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #651DH

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #6525H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #652DH

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #6535H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #653DH

LCALL SENDBINCOUT

LCALL sendf0crc

LCALL CONTSDSP

RET

; 向UART发送BIN计数结果

SENDBINCOUT:

PUSH 40H

LDB SETINDEX, #06H

LDB 0D0H, #0AH

L8A28H:

CMPB 0D0H, [40H]

JNH L8A34H

DEC 40H

DJNZ SETINDEX, L8A28H

SJMP L8A46H

L8A34H:

POP 40H

PUSH 40H

LDB SETINDEX, #06H

LDB 0D0H, #00H

L8A3EH:

STB 0D0H, [40H]

DEC 40H

DJNZ SETINDEX, L8A3EH

; 压缩导前0,并转换成ASCII码发送

L8A46H:

POP 40H

LDB SETINDEX, #06H

LDB 0D0H, #00H

L8A4EH:

LDB SENDTEMP, [40H]

CMPB SETINDEX, #01H

JE L8A63H

CMPB 0D0H, #00H

JNE L8A63H

CMPB 00H, SENDTEMP

JE L8A69H

LDB 0D0H, #0FFH

L8A63H:

ORB SENDTEMP, #30H

LCALL SENDTEMP2

L8A69H:

DEC 40H

DJNZ SETINDEX, L8A4EH

RET

; 向UART发送BIN(38H) #2C,计算CRC

SEND38H:

LCALL SENDBIN

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

RET

; 发送指定BIN COUNTER

SDTISBINCOUT:

LCALL L8855H

LCALL L86ECH

; 发送当前BIN COUNTER

SDCURBINCOUT:

LDB SETINDEX, 38H

LD 40H, #6505H

MULUB SETINDEX, #08H

ADD 40H, SETINDEX

CLRB 0BFH

LDB SENDTEMP, #0A2H

LCALL SENDTEMP2

INCB 38H

LCALL SEND38H

LCALL SENDBINCOUT

LCALL sendf0crc

RET

; 发出第一二页之设定

SDP12SET:

CLRB 0BFH

LDB SENDTEMP, #0A3H

LCALL SENDTEMP2

LCALL SDP12SETG

LCALL sendf0crc

RET

; SEND P12

SD1PSET:

之1指定设定

LCALL L8855H

LCALL L86ECH

; SEND P12之1设定

SD1SET:

LDB SETINDEX, 38H

LD 40H, #6000H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CLRB 0BFH

LDB SENDTEMP, #0A4H

LCALL SENDTEMP2

INCB 38H

LCALL SEND38H

LCALL CKANDSD40H

LCALL sendf0crc

RET

; 发出第三页之设定

SDP3SET:

CLRB 0BFH

LDB SENDTEMP, #0A5H

LCALL SENDTEMP2

LCALL SDP3SETG

LCALL sendf0crc

RET

; SEND P3之1指定设定

SD3PDRV:

LCALL L8855H

LCALL L86ECH

; SEND P3之1设定

SD3DRV:

LDB SETINDEX, 38H

LD 40H, #6200H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CLRB 0BFH

LDB SENDTEMP, #0A6H

LCALL SENDTEMP2

INCB 38H

LCALL SEND38H

LCALL CKANDSD40H

LCALL sendf0crc

RET

L8B0CH:

NOP

RET

; 回答[7B02H]

RESP7b02:

NOP

CLRB 0BFH

LDB SENDTEMP, #0B0H

LCALL SENDTEMP2

LDB SENDTEMP, 7B02H[00H]

ORB SENDTEMP, #30H

LCALL SENDTEMP2

LCALL sendf0crc

RET

;

RESP7b00:

回答[7B00H]

NOP

CLRB 0BFH

LDB SENDTEMP, #0B1H

LCALL SENDTEMP2

LDB SENDTEMP, 7B00H[00H]

ORB SENDTEMP, #30H

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 回复[7B10H]起的序列

RESP7b10A:

NOP

CLRB 0BFH

LDB SENDTEMP, #0B2H

LCALL SENDTEMP2

LD 40H, #7B10H

L8B4BH:

LDB SENDTEMP, [40H]+

LCALL SENDTEMP2

LDB SENDTEMP, [40H]

CMPB SENDTEMP, 00H

JNE L8B4BH

LCALL sendf0crc

RET

; 回复[7B20H]、[7B24H]的数据

RESP7b20T24:

NOP

CLRB 0BFH

LDB SENDTEMP, #0B3H

LCALL SENDTEMP2

LD 38H, 7B20H[00H]

LCALL BIN2BCD

LD 40H, #0034H

LDB SETINDEX, #05H

L8B75H:

LDB SENDTEMP, [40H]

CMPB SENDTEMP, #00H

JE L8B83H

ORB SENDTEMP, #30H

LCALL SENDTEMP2

L8B83H:

DEC 40H

DJNZ SETINDEX, L8B75H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 38H, 7B24H[00H]

LCALL BIN2BCD

LD 40H, #0034H

LDB SETINDEX, #05H

L8B9DH:

LDB SENDTEMP, [40H]

CMPB SENDTEMP, #00H

JE L8BABH

ORB SENDTEMP, #30H

LCALL SENDTEMP2

L8BABH:

DEC 40H

DJNZ SETINDEX, L8B9DH

LCALL sendf0crc

RET

; ...

L8BB4H:

NOP

CLRB 0BFH

LDB SENDTEMP, #0C0H

ORB SENDTEMP, 0D0H

LCALL SENDTEMP2

LCALL sendf0crc

RET

; ...

SDD0F0CRC:

NOP

CLRB 0BFH

LDB SENDTEMP, #0D0H

LCALL SENDTEMP2

LCALL sendf0crc

RET

;

SDRSLT:

发出测试结果

NOP

CLRB 0BFH

LDB SENDTEMP, #0D1H

LCALL SENDTEMP2

LDB 0D0H, 7B28H[00H]

CMPB 0D0H, #0FFH

JNE L8BEAH

LDB SENDTEMP, #53H

LCALL SENDTEMP2

L8BEAH:

LDB SENDTEMP, #31H

LCALL SENDTEMP2

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

; 发出

BIN,CONTA,CONTC,POLAR,VF,Vz1,DVz,VRT,IRT,D

IR

L8BF6H:

结果数据

LDB SETINDEX, #00H

LD 40H, #6300H

LDB 38H, SETINDEX

MULUB 38H, #04H

ADD 40H, 38H

CMP 40H, #6328H

JE L8C19H

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

INCB SETINDEX

SJMP 8BF9H

L8C19H:

LCALL CKANDSD40H

LCALL sendf0crc

RET

;

SDTIME:

发出TIME,TIMEC,PCSPS,KPH测试结果

CLRB 0BFH

LDB SENDTEMP, #0D2H

LCALL SENDTEMP2

LDB 0D0H, 7B28H[00H]

CMPB 0D0H, #0FFH

JNE L8C38H

LDB SENDTEMP, #53H

LCALL SENDTEMP2

L8C38H:

LDB SENDTEMP, #30H

LCALL SENDTEMP2

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LDB SETINDEX, #00H

LD 40H, #6380H

LDB 38H, SETINDEX

MULUB 38H, #04H

ADD 40H, 38H

CMP 40H, #6390H

JE L8C67H

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

INCB SETINDEX

SJMP 8C47H

L8C67H:

LCALL CKANDSD40H

LCALL sendf0crc

RET

L8C6EH:

NOP

RET

L8C70H:

NOP

RET

; 发出仪表ID

SDID:

NOP

CLRB 0BFH

LDB SENDTEMP, #0E4H

LCALL SENDTEMP2

LD 40H, #0C3D9H

L8C7FH:

LDB SENDTEMP, [40H]+

LCALL SENDTEMP2

LDB SENDTEMP, [40H]

CMPB SENDTEMP, #20H

JNE L8C7FH

LCALL sendf0crc

RET

;

SDP12SETG:

发出第一二页之设定

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

LDB SETINDEX, 7B06H[00H]

LD 40H, #6000H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CMP 40H, #6104H

JE L8CC7H

JH L8CC7H

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP 8C99H

L8CC7H:

RET

; 发出第三页之设定

SDP3SETG:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

LDB SETINDEX, 7B06H[00H]

LD 40H, #6200H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CMP 40H, #627CH

JE L8CFEH

JH L8CFEH

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP 8CD0H

L8CFEH:

RET

L8CFFH:

STB 00H, T1

;

L8D02H:

清WDT

STB 30H, 1400H[00H]

PUSH EDITINDEX

LDB EDITINDEX, #00H

L8D0CH:

LD 40H, #9F90H

LDBZE 38H, EDITINDEX

MULU 38H, #0002H

ADD 40H, 38H

LD 40H, [40H]

LD 30H, [40H]+

LDB 7CH, [40H]

LCALL CHACKIN

LCALL INPUTSTD

LCALL INPUTSTD2

INCB EDITINDEX

CMPB EDITINDEX, #76H

JNE L8D0CH

POP EDITINDEX

LDB 48H, #01H

L8D38H:

LCALL SETINGDISP

INCB 48H

CMPB 48H, #76H

JNE L8D38H

RET

; UART

sendf0crc:

发送#0f0h,并计算校验

LDB SENDTEMP, #0F0H

LCALL SENDTEMP2

CLRB SENDTEMP

; 校验

L8D4BH:

SUBB SENDTEMP, 0BFH

CMPB SENDTEMP, #11H

JE L8D5BH

CMPB SENDTEMP, #13H

JE L8D5BH

SCALL SENDTEMP

RET

; 校验值为11h,13h时改0

L8D5BH:

LDB SENDTEMP, #00H

SCALL SENDTEMP

RET

; 发送校验值

SENDTEMP:

DI

CMP SENDPOINT1, #7800H

JH L8D78H

CMP SENDPOINT1, SENDPOINT2

JE L8D72H

STB SENDTEMP, [SENDPOINT1]+

EI

RET

L8D72H:

STB SENDTEMP, SBUF

STB SENDTEMP, [SENDPOINT1]+

L8D78H:

EI

RET

; UART发送B4h内容并计算CRC

SENDTEMP2:

DI

CMP SENDPOINT1, #7800H

; sendpoint1>7800(超限),不发送

L8D7FH:

JH L8D97H

CMP SENDPOINT1, SENDPOINT2

JE L8D8EH

; sendpoint1!=point2,存入内存

L8D86H:

STB SENDTEMP, [SENDPOINT1]+

ADDB 0BFH, SENDTEMP

EI

RET

; sentpoint1=2,发送并存入

L8D8EH:

STB SENDTEMP, SBUF

STB SENDTEMP, [SENDPOINT1]+

ADDB 0BFH, SENDTEMP

L8D97H:

EI

RET

;

CKANDSD40H:

检查并发送[40H],并存入CRC

LD 30H, [40H]

CMP 30H, #0FFFFH

JNE L8DA3H

RET

L8DA3H:

LD 30H, [40H]

CMP 30H, 00H

JE L8DAFH

LCALL SEND40H

RET

L8DAFH:

LDB SENDTEMP, #30H

LCALL SENDTEMP2

RET

; 发送[40H],并存入CRC

SEND40H:

LD 30H, [40H]+

LDB 7CH, [40H]+

INC 40H

LD 32H, 00H

LDB HEDZCLRED, 00H

CMPB 7CH, 00H

JNE L8DCBH

SJMP L8DDCH

L8DCBH:

SUBB 7CH, #04H

CMPB 7CH, 00H

JNE L8DDCH

LDB HEDZCLRED, #0FFH

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

L8DDCH:

DIVU 30H, #1000H

ORB 30H, #30H

CMPB HEDZCLRED, #0FFH

JE L8DF0H

CMPB 30H, #30H

JE L8DF6H

LDB HEDZCLRED, #0FFH

L8DF0H:

LDB SENDTEMP, 30H

LCALL SENDTEMP2

L8DF6H:

INCB 7CH

JNE L8E03H

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

LDB HEDZCLRED, #0FFH

L8E03H:

LD 30H, 32H

LD 32H, 00H

DIVU 30H, #0100H

ORB 30H, #30H

CMPB HEDZCLRED, #0FFH

JE L8E1DH

CMPB 30H, #30H

JE L8E23H

LDB HEDZCLRED, #0FFH

L8E1DH:

LDB SENDTEMP, 30H

LCALL SENDTEMP2

L8E23H:

INCB 7CH

JNE L8E30H

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

LDB HEDZCLRED, #0FFH

L8E30H:

LD 30H, 32H

LD 32H, 00H

DIVU 30H, #0010H

ORB 30H, #30H

CMPB HEDZCLRED, #0FFH

JE L8E4AH

CMPB 30H, #30H

JE L8E50H

LDB HEDZCLRED, #0FFH

L8E4AH:

LDB SENDTEMP, 30H

LCALL SENDTEMP2

L8E50H:

INCB 7CH

JNE L8E5AH

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

L8E5AH:

LDB 30H, 32H

ORB 30H, #30H

LDB SENDTEMP, 30H

LCALL SENDTEMP2

RET

LCALL L8E71H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

RET

L8E71H:

LD 38H, [40H]+

; 发送BIN2UART

SENDBIN:

LCALL BIN2BCD

LDB HEDZCLRED, 00H

LDB SENDTEMP, 34H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8E8BH

LCALL SENDTEMP2

L8E8BH:

LDB SENDTEMP, 33H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8E9CH

LCALL SENDTEMP2

L8E9CH:

LDB SENDTEMP, 32H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8EADH

LCALL SENDTEMP2

L8EADH:

LDB SENDTEMP, 31H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8EBEH

LCALL SENDTEMP2

L8EBEH:

LDB SENDTEMP, 30H

ORB SENDTEMP, #30H

LCALL SENDTEMP2

RET

; 清除发送的导前0

CLR30:

CMPB HEDZCLRED, #0FFH

JE L8EDAH

CMPB SENDTEMP, #30H

JE L8ED7H

LDB HEDZCLRED, #0FFH

SJMP L8EDAH

L8ED7H:

LDB SENDTEMP, #20H

L8EDAH:

RET

LDB SETINDEX, #05H

L8EDEH:

LDB SENDTEMP, [40H]+

LCALL SENDTEMP2

DJNZ SETINDEX, L8EDEH

RET

; SEND E553 &CRC

SAYTRRTST:

NOP

CLRB 0BFH

LDB SENDTEMP, #0E5H

LCALL SENDTEMP2

LDB SENDTEMP, #53H

SCALL SENDTEMP2

LCALL sendf0crc

RET

2024年5月14日发(作者:妫晗日)

; UART命令处理程序

UartCMDPRC:

CLRB CMDCRC

NOP

LD 40H, PROPOINT

LD 42H, #7000H

L8474H:

LDB 0D0H, [40H]+

STB 0D0H, [42H]+

CMP 42H, #73FFH

JH COMerr

ADDB CMDCRC, 0D0H

CMP 40H, #7000H

JNE L848DH

LD 40H, #6800H

; 找结束标志F0

L848DH:

CMPB 0D0H, #0F0H

JNE L8474H

;

L8492H:

读CRC

LDB 0D0H, [40H]+

STB 0D0H, [42H]+

ADDB CMDCRC, 0D0H

CMP 40H, #7000H

JNE L84A5H

LD 40H, #6800H

L84A5H:

LD PROPOINT, 40H

DECB CMDCONTER

CMPB CMDCRC, #00H

JE CMDPRC

CMPB CMDCRC, #0EFH

JE CMDPRC

CMPB CMDCRC, #0EDH

JE CMDPRC

; UARTCMD错误

COMerr:

LCALL CLRUARTRAM

RET

;

CMDPRC:

命令处理

LD 40H, #7000H

LDB 0D0H, [40H]+

CMPB 0D0H, #0A0H

JNE L84CDH

LCALL rstCOUNT

RET

L84CDH:

CMPB 0D0H, #0A1H

JNE L84D6H

LCALL L857AH

RET

L84D6H:

CMPB 0D0H, #0A2H

JNE L84DFH

LCALL L8589H

RET

L84DFH:

CMPB 0D0H, #0A3H

JNE L84E8H

LCALL L859EH

RET

L84E8H:

CMPB 0D0H, #0A4H

JNE L84F1H

LCALL L85ADH

RET

L84F1H:

CMPB 0D0H, #0A5H

JNE L84FAH

LCALL L85C2H

RET

L84FAH:

CMPB 0D0H, #0A6H

JNE L8503H

LCALL L85D1H

RET

L8503H:

CMPB 0D0H, #0A7H

JNE L850CH

LCALL L85E6H

RET

L850CH:

CMPB 0D0H, #0A8H

JNE L8515H

LCALL L85F3H

RET

L8515H:

CMPB 0D0H, #0A9H

JNE L851EH

LCALL UartRST

RET

L851EH:

CMPB 0D0H, #0B0H

JNE L8527H

LCALL L8618H

RET

L8527H:

CMPB 0D0H, #0B1H

JNE L8530H

LCALL L8630H

RET

L8530H:

CMPB 0D0H, #0B2H

JNE L8539H

LCALL L864DH

RET

L8539H:

CMPB 0D0H, #0B3H

JNE L8542H

LCALL L8678H

RET

L8542H:

CMPB 0D0H, #0B4H

JNE L854BH

LCALL L86B8H

RET

L854BH:

CMPB 0D0H, #0B5H

JNE L8554H

LCALL L86C5H

RET

L8554H:

CMPB 0D0H, #0B6H

JNE L855DH

LCALL L86D2H

RET

L855DH:

CMPB 0D0H, #0B7H

JNE L8566H

LCALL L86DFH

RET

L8566H:

NOP

RET

; 计数器清除

rstCOUNT:

LDB FCOUTRST, #55H

LCALL COUNTRST

LDB 0D0H, #0A0H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L857AH:

LCALL L8720H

LDB 0D0H, #0A1H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L8589H:

LCALL L8855H

LCALL L86ECH

LCALL L8728H

LDB 0D0H, #0A2H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L859EH:

LCALL L8767H

LDB 0D0H, #0A3H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85ADH:

LCALL L8855H

LCALL L86ECH

LCALL L876FH

LDB 0D0H, #0A4H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85C2H:

LCALL L87CDH

LDB 0D0H, #0A5H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85D1H:

LCALL L8855H

LCALL L86ECH

LCALL L87D5H

LDB 0D0H, #0A6H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85E6H:

NOP

LDB 0D0H, #0A7H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L85F3H:

LCALL CMDPROC

LDB 0D0H, #0A8H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

; UART复位程序

UartRST:

LDB 0D0H, #0A9H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

LD SETINDEX, #0FA0H

L8611H:

DJNZW SETINDEX, L8611H

LCALL CLRUARTRAM

RET

L8618H:

NOP

LDB 0D0H, [40H]

ANDB 0D0H, #0FH

STB 0D0H, 7B02H[00H]

LDB 0D0H, #0B0H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L8630H:

LCALL L8855H

LCALL L86F7H

LDB 0D0H, 38H

ANDB 0D0H, #0FH

STB 0D0H, 7B00H[00H]

LDB 0D0H, #0B1H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L864DH:

NOP

LD 42H, #7B10H

LDB SETINDEX, #10H

L8655H:

STB 00H, [42H]+

DJNZ SETINDEX, L8655H

LD 42H, #7B10H

LDB 0D0H, [40H]+

CMPB 0D0H, #0F0H

JE L866CH

STB 0D0H, [42H]+

SJMP 865FH

L866CH:

LDB 0D0H, #0B2H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L8678H:

LCALL L8855H

LCALL L86F7H

ST 38H, 7B20H[00H]

LCALL L8855H

LCALL L86F7H

ST 38H, 7B24H[00H]

LD 38H, 7B20H[00H]

CLR 3AH

DIVU 38H, 7B24H[00H]

MULU 38H, #000BH

DIVU 38H, #000AH

ST 38H, 7B2CH[00H]

ST 00H, 7B34H[00H]

LDB 0D0H, #0B3H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86B8H:

NOP

LDB 0D0H, #0B4H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86C5H:

NOP

LDB 0D0H, #0B5H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86D2H:

NOP

LDB 0D0H, #0B6H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86DFH:

NOP

LDB 0D0H, #0B7H

STB 0D0H, 7B04H[00H]

LCALL sE07B04CRC

RET

L86ECH:

LCALL L86F7H

DECB 38H

STB 38H, 7B06H[00H]

RET

L86F7H:

LD 0B2H, #7A10H

LDB 30H, [0B2H]+

LDB 31H, [0B2H]+

LDB 32H, [0B2H]+

LDB 33H, [0B2H]+

LDB 34H, [0B2H]+

SHLB 31H, #04H

ORB 30H, 31H

SHLB 33H, #04H

LDB 31H, 32H

ORB 31H, 33H

LDB 32H, 34H

LCALL CBCD2BIN

RET

L8720H:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

L8728H:

LCALL L8855H

LDB SETINDEX, 7B06H[00H]

LD 42H, #6500H

MULUB SETINDEX, #08H

ADD 42H, SETINDEX

LDB SETINDEX, #08H

LD 0B2H, #7A10H

L8741H:

LDB 0D0H, [0B2H]+

STB 0D0H, [42H]+

DJNZ SETINDEX, L8741H

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L8763H

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

CMPB SETINDEX, #0FH

JNH L8728H

L8763H:

LCALL CONTSDSP

RET

L8767H:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

L876FH:

LCALL L8855H

LCALL L883EH

LDB SETINDEX, 7B06H[00H]

LD 42H, #6000H

MULUB SETINDEX, #04H

ADD 42H, SETINDEX

CMP 42H, #6104H

JE L87C9H

JH L87C9H

PUSH 40H

PUSH EDITINDEX

LDB EDITINDEX, #00H

LD 0B2H, #9F90H

LDB 38H, EDITINDEX

MULUB 38H, #02H

ADD 0B2H, 38H

LD 0D0H, [0B2H]

CMP 0D0H, 42H

JE L87ACH

INCB EDITINDEX

SJMP 8793H

L87ACH:

LCALL CHACKIN

POP EDITINDEX

POP 40H

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L87C9H

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP L876FH

L87C9H:

LCALL L8CFFH

RET

L87CDH:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

L87D5H:

LCALL L8855H

LCALL L883EH

LDB SETINDEX, 7B06H[00H]

LD 42H, #6200H

MULUB SETINDEX, #04H

ADD 42H, SETINDEX

CMP 42H, #627CH

JE L883CH

JH L883CH

PUSH 40H

PUSH EDITINDEX

LDB EDITINDEX, #00H

L87F9H:

LD 0B2H, #9F90H

LDB 38H, EDITINDEX

MULUB 38H, #02H

ADD 0B2H, 38H

LD 0D0H, [0B2H]

CMP 0D0H, 42H

JE L8817H

INCB EDITINDEX

CMPB EDITINDEX, #76H

JNE L87F9H

JE L8822H

L8817H:

LCALL CHACKIN

LDB 48H, EDITINDEX

INCB 48H

LCALL SETINGDISP

L8822H:

POP EDITINDEX

POP 40H

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L883CH

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP L87D5H

L883CH:

NOP

RET

L883EH:

LD 0B2H, #7A10H

LDB 84H, [0B2H]+

LDB 83H, [0B2H]+

LDB 82H, [0B2H]+

LDB 81H, [0B2H]+

LDB 80H, [0B2H]+

LCALL L97DCH

RET

L8855H:

LD 42H, #7A00H

L8859H:

LDB 0D0H, [40H]

CMPB 0D0H, #0F0H

JE L886DH

INC 40H

CMPB 0D0H, #2CH

JE L886DH

STB 0D0H, [42H]+

JNE L8859H

L886DH:

DEC 42H

ST 00H, 7A10H[00H]

ST 00H, 7A12H[00H]

ST 00H, 7A14H[00H]

ST 00H, 7A16H[00H]

LD 0B2H, #7A10H

L8887H:

LDB 0D0H, [42H]

CMPB 0D0H, #2EH

JE L8892H

ANDB 0D0H, #0FH

L8892H:

STB 0D0H, [0B2H]+

DEC 42H

CMP 42H, #79FFH

JNE L8887H

RET

; 清理UART用内存

CLRUARTRAM:

NOP

CLRB CMDCONTER

CLRB CMDDATA

LD RECPOINT, #6800H

LD PROPOINT, #6800H

LDB 0D0H, SBUF

LDB 0D0H, SBUF

LD SENDPOINT1, #7400H

LD SENDPOINT2, #7400H

LD 42H, #6800H

L88BDH:

ST 00H, [42H]+

CMP 42H, #7400H

JNE L88BDH

LDB 0D0H, 00H

ORB 0D0H, #08H

STB 0D0H, 7B00H[00H]

STB 00H, 7B02H[00H]

STB 00H, RSTCMD

CLRB TRRRECIVE

RET

;

senda9&crc:

向UART发送报文为#0A9h的信息

CLRB 0BFH

LDB SENDTEMP, #0A9H

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 向UART发送报文为#0E0h,7B04H,CRC的信息

sE07B04CRC:

CLRB 0BFH

LDB SENDTEMP, #0E0H

LCALL SENDTEMP2

LDB SENDTEMP, 7B04H[00H]

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 向UART发送报文为#0E1h,7B04H,CRC的信息

sE17B04CRC:

CLRB 0BFH

LDB SENDTEMP, #0E1H

LCALL SENDTEMP2

LDB SENDTEMP, 7B04H[00H]

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 收到命令处理

CMDPROC:

NOP

LDB 0D0H, [40H]+

CMPB 0D0H, #0A1H

JNE L891DH

LCALL SENDALLCOUT

RET

L891DH:

CMPB 0D0H, #0A2H

JNE L8926H

LCALL SDTISBINCOUT

RET

L8926H:

CMPB 0D0H, #0A3H

JNE L892FH

LCALL SDP12SET

RET

L892FH:

CMPB 0D0H, #0A4H

JNE L8938H

LCALL SD1PSET

RET

L8938H:

CMPB 0D0H, #0A5H

JNE L8941H

LCALL SDP3SET

RET

L8941H:

CMPB 0D0H, #0A6H

JNE L894AH

LCALL SD3PDRV

RET

L894AH:

CMPB 0D0H, #0A7H

JNE L8953H

LCALL L8B0CH

RET

L8953H:

CMPB 0D0H, #0B0H

JNE L895CH

LCALL RESP7b02

RET

L895CH:

CMPB 0D0H, #0B1H

JNE L8965H

LCALL RESP7b00

RET

L8965H:

CMPB 0D0H, #0B2H

JNE L896EH

LCALL RESP7b10A

RET

L896EH:

CMPB 0D0H, #0B3H

JNE L8977H

LCALL RESP7b20T24

RET

L8977H:

CMPB 0D0H, #0D0H

JNE L8980H

LCALL SDD0F0CRC

RET

L8980H:

CMPB 0D0H, #0D1H

JNE L8989H

LCALL SDRSLT

RET

L8989H:

CMPB 0D0H, #0D2H

JNE L8992H

LCALL SDTIME

RET

L8992H:

CMPB 0D0H, #0E2H

JNE L899BH

LCALL L8C6EH

RET

L899BH:

CMPB 0D0H, #0E3H

JNE L89A4H

LCALL L8C70H

RET

L89A4H:

CMPB 0D0H, #0E4H

JNE L89ADH

LCALL SDID

RET

L89ADH:

NOP

RET

; 向UART发送所有BIN计数结果

SENDALLCOUT:

CLRB 0BFH

LDB SENDTEMP, #0A1H

LCALL SENDTEMP2

LD 40H, #6505H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #650DH

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #6515H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #651DH

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #6525H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #652DH

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #6535H

LCALL SENDBINCOUT

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 40H, #653DH

LCALL SENDBINCOUT

LCALL sendf0crc

LCALL CONTSDSP

RET

; 向UART发送BIN计数结果

SENDBINCOUT:

PUSH 40H

LDB SETINDEX, #06H

LDB 0D0H, #0AH

L8A28H:

CMPB 0D0H, [40H]

JNH L8A34H

DEC 40H

DJNZ SETINDEX, L8A28H

SJMP L8A46H

L8A34H:

POP 40H

PUSH 40H

LDB SETINDEX, #06H

LDB 0D0H, #00H

L8A3EH:

STB 0D0H, [40H]

DEC 40H

DJNZ SETINDEX, L8A3EH

; 压缩导前0,并转换成ASCII码发送

L8A46H:

POP 40H

LDB SETINDEX, #06H

LDB 0D0H, #00H

L8A4EH:

LDB SENDTEMP, [40H]

CMPB SETINDEX, #01H

JE L8A63H

CMPB 0D0H, #00H

JNE L8A63H

CMPB 00H, SENDTEMP

JE L8A69H

LDB 0D0H, #0FFH

L8A63H:

ORB SENDTEMP, #30H

LCALL SENDTEMP2

L8A69H:

DEC 40H

DJNZ SETINDEX, L8A4EH

RET

; 向UART发送BIN(38H) #2C,计算CRC

SEND38H:

LCALL SENDBIN

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

RET

; 发送指定BIN COUNTER

SDTISBINCOUT:

LCALL L8855H

LCALL L86ECH

; 发送当前BIN COUNTER

SDCURBINCOUT:

LDB SETINDEX, 38H

LD 40H, #6505H

MULUB SETINDEX, #08H

ADD 40H, SETINDEX

CLRB 0BFH

LDB SENDTEMP, #0A2H

LCALL SENDTEMP2

INCB 38H

LCALL SEND38H

LCALL SENDBINCOUT

LCALL sendf0crc

RET

; 发出第一二页之设定

SDP12SET:

CLRB 0BFH

LDB SENDTEMP, #0A3H

LCALL SENDTEMP2

LCALL SDP12SETG

LCALL sendf0crc

RET

; SEND P12

SD1PSET:

之1指定设定

LCALL L8855H

LCALL L86ECH

; SEND P12之1设定

SD1SET:

LDB SETINDEX, 38H

LD 40H, #6000H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CLRB 0BFH

LDB SENDTEMP, #0A4H

LCALL SENDTEMP2

INCB 38H

LCALL SEND38H

LCALL CKANDSD40H

LCALL sendf0crc

RET

; 发出第三页之设定

SDP3SET:

CLRB 0BFH

LDB SENDTEMP, #0A5H

LCALL SENDTEMP2

LCALL SDP3SETG

LCALL sendf0crc

RET

; SEND P3之1指定设定

SD3PDRV:

LCALL L8855H

LCALL L86ECH

; SEND P3之1设定

SD3DRV:

LDB SETINDEX, 38H

LD 40H, #6200H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CLRB 0BFH

LDB SENDTEMP, #0A6H

LCALL SENDTEMP2

INCB 38H

LCALL SEND38H

LCALL CKANDSD40H

LCALL sendf0crc

RET

L8B0CH:

NOP

RET

; 回答[7B02H]

RESP7b02:

NOP

CLRB 0BFH

LDB SENDTEMP, #0B0H

LCALL SENDTEMP2

LDB SENDTEMP, 7B02H[00H]

ORB SENDTEMP, #30H

LCALL SENDTEMP2

LCALL sendf0crc

RET

;

RESP7b00:

回答[7B00H]

NOP

CLRB 0BFH

LDB SENDTEMP, #0B1H

LCALL SENDTEMP2

LDB SENDTEMP, 7B00H[00H]

ORB SENDTEMP, #30H

LCALL SENDTEMP2

LCALL sendf0crc

RET

; 回复[7B10H]起的序列

RESP7b10A:

NOP

CLRB 0BFH

LDB SENDTEMP, #0B2H

LCALL SENDTEMP2

LD 40H, #7B10H

L8B4BH:

LDB SENDTEMP, [40H]+

LCALL SENDTEMP2

LDB SENDTEMP, [40H]

CMPB SENDTEMP, 00H

JNE L8B4BH

LCALL sendf0crc

RET

; 回复[7B20H]、[7B24H]的数据

RESP7b20T24:

NOP

CLRB 0BFH

LDB SENDTEMP, #0B3H

LCALL SENDTEMP2

LD 38H, 7B20H[00H]

LCALL BIN2BCD

LD 40H, #0034H

LDB SETINDEX, #05H

L8B75H:

LDB SENDTEMP, [40H]

CMPB SENDTEMP, #00H

JE L8B83H

ORB SENDTEMP, #30H

LCALL SENDTEMP2

L8B83H:

DEC 40H

DJNZ SETINDEX, L8B75H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LD 38H, 7B24H[00H]

LCALL BIN2BCD

LD 40H, #0034H

LDB SETINDEX, #05H

L8B9DH:

LDB SENDTEMP, [40H]

CMPB SENDTEMP, #00H

JE L8BABH

ORB SENDTEMP, #30H

LCALL SENDTEMP2

L8BABH:

DEC 40H

DJNZ SETINDEX, L8B9DH

LCALL sendf0crc

RET

; ...

L8BB4H:

NOP

CLRB 0BFH

LDB SENDTEMP, #0C0H

ORB SENDTEMP, 0D0H

LCALL SENDTEMP2

LCALL sendf0crc

RET

; ...

SDD0F0CRC:

NOP

CLRB 0BFH

LDB SENDTEMP, #0D0H

LCALL SENDTEMP2

LCALL sendf0crc

RET

;

SDRSLT:

发出测试结果

NOP

CLRB 0BFH

LDB SENDTEMP, #0D1H

LCALL SENDTEMP2

LDB 0D0H, 7B28H[00H]

CMPB 0D0H, #0FFH

JNE L8BEAH

LDB SENDTEMP, #53H

LCALL SENDTEMP2

L8BEAH:

LDB SENDTEMP, #31H

LCALL SENDTEMP2

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

; 发出

BIN,CONTA,CONTC,POLAR,VF,Vz1,DVz,VRT,IRT,D

IR

L8BF6H:

结果数据

LDB SETINDEX, #00H

LD 40H, #6300H

LDB 38H, SETINDEX

MULUB 38H, #04H

ADD 40H, 38H

CMP 40H, #6328H

JE L8C19H

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

INCB SETINDEX

SJMP 8BF9H

L8C19H:

LCALL CKANDSD40H

LCALL sendf0crc

RET

;

SDTIME:

发出TIME,TIMEC,PCSPS,KPH测试结果

CLRB 0BFH

LDB SENDTEMP, #0D2H

LCALL SENDTEMP2

LDB 0D0H, 7B28H[00H]

CMPB 0D0H, #0FFH

JNE L8C38H

LDB SENDTEMP, #53H

LCALL SENDTEMP2

L8C38H:

LDB SENDTEMP, #30H

LCALL SENDTEMP2

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LDB SETINDEX, #00H

LD 40H, #6380H

LDB 38H, SETINDEX

MULUB 38H, #04H

ADD 40H, 38H

CMP 40H, #6390H

JE L8C67H

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

INCB SETINDEX

SJMP 8C47H

L8C67H:

LCALL CKANDSD40H

LCALL sendf0crc

RET

L8C6EH:

NOP

RET

L8C70H:

NOP

RET

; 发出仪表ID

SDID:

NOP

CLRB 0BFH

LDB SENDTEMP, #0E4H

LCALL SENDTEMP2

LD 40H, #0C3D9H

L8C7FH:

LDB SENDTEMP, [40H]+

LCALL SENDTEMP2

LDB SENDTEMP, [40H]

CMPB SENDTEMP, #20H

JNE L8C7FH

LCALL sendf0crc

RET

;

SDP12SETG:

发出第一二页之设定

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

LDB SETINDEX, 7B06H[00H]

LD 40H, #6000H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CMP 40H, #6104H

JE L8CC7H

JH L8CC7H

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP 8C99H

L8CC7H:

RET

; 发出第三页之设定

SDP3SETG:

LDB 0D0H, 00H

STB 0D0H, 7B06H[00H]

LDB SETINDEX, 7B06H[00H]

LD 40H, #6200H

MULUB SETINDEX, #04H

ADD 40H, SETINDEX

CMP 40H, #627CH

JE L8CFEH

JH L8CFEH

LCALL CKANDSD40H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

LDB SETINDEX, 7B06H[00H]

INCB SETINDEX

STB SETINDEX, 7B06H[00H]

SJMP 8CD0H

L8CFEH:

RET

L8CFFH:

STB 00H, T1

;

L8D02H:

清WDT

STB 30H, 1400H[00H]

PUSH EDITINDEX

LDB EDITINDEX, #00H

L8D0CH:

LD 40H, #9F90H

LDBZE 38H, EDITINDEX

MULU 38H, #0002H

ADD 40H, 38H

LD 40H, [40H]

LD 30H, [40H]+

LDB 7CH, [40H]

LCALL CHACKIN

LCALL INPUTSTD

LCALL INPUTSTD2

INCB EDITINDEX

CMPB EDITINDEX, #76H

JNE L8D0CH

POP EDITINDEX

LDB 48H, #01H

L8D38H:

LCALL SETINGDISP

INCB 48H

CMPB 48H, #76H

JNE L8D38H

RET

; UART

sendf0crc:

发送#0f0h,并计算校验

LDB SENDTEMP, #0F0H

LCALL SENDTEMP2

CLRB SENDTEMP

; 校验

L8D4BH:

SUBB SENDTEMP, 0BFH

CMPB SENDTEMP, #11H

JE L8D5BH

CMPB SENDTEMP, #13H

JE L8D5BH

SCALL SENDTEMP

RET

; 校验值为11h,13h时改0

L8D5BH:

LDB SENDTEMP, #00H

SCALL SENDTEMP

RET

; 发送校验值

SENDTEMP:

DI

CMP SENDPOINT1, #7800H

JH L8D78H

CMP SENDPOINT1, SENDPOINT2

JE L8D72H

STB SENDTEMP, [SENDPOINT1]+

EI

RET

L8D72H:

STB SENDTEMP, SBUF

STB SENDTEMP, [SENDPOINT1]+

L8D78H:

EI

RET

; UART发送B4h内容并计算CRC

SENDTEMP2:

DI

CMP SENDPOINT1, #7800H

; sendpoint1>7800(超限),不发送

L8D7FH:

JH L8D97H

CMP SENDPOINT1, SENDPOINT2

JE L8D8EH

; sendpoint1!=point2,存入内存

L8D86H:

STB SENDTEMP, [SENDPOINT1]+

ADDB 0BFH, SENDTEMP

EI

RET

; sentpoint1=2,发送并存入

L8D8EH:

STB SENDTEMP, SBUF

STB SENDTEMP, [SENDPOINT1]+

ADDB 0BFH, SENDTEMP

L8D97H:

EI

RET

;

CKANDSD40H:

检查并发送[40H],并存入CRC

LD 30H, [40H]

CMP 30H, #0FFFFH

JNE L8DA3H

RET

L8DA3H:

LD 30H, [40H]

CMP 30H, 00H

JE L8DAFH

LCALL SEND40H

RET

L8DAFH:

LDB SENDTEMP, #30H

LCALL SENDTEMP2

RET

; 发送[40H],并存入CRC

SEND40H:

LD 30H, [40H]+

LDB 7CH, [40H]+

INC 40H

LD 32H, 00H

LDB HEDZCLRED, 00H

CMPB 7CH, 00H

JNE L8DCBH

SJMP L8DDCH

L8DCBH:

SUBB 7CH, #04H

CMPB 7CH, 00H

JNE L8DDCH

LDB HEDZCLRED, #0FFH

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

L8DDCH:

DIVU 30H, #1000H

ORB 30H, #30H

CMPB HEDZCLRED, #0FFH

JE L8DF0H

CMPB 30H, #30H

JE L8DF6H

LDB HEDZCLRED, #0FFH

L8DF0H:

LDB SENDTEMP, 30H

LCALL SENDTEMP2

L8DF6H:

INCB 7CH

JNE L8E03H

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

LDB HEDZCLRED, #0FFH

L8E03H:

LD 30H, 32H

LD 32H, 00H

DIVU 30H, #0100H

ORB 30H, #30H

CMPB HEDZCLRED, #0FFH

JE L8E1DH

CMPB 30H, #30H

JE L8E23H

LDB HEDZCLRED, #0FFH

L8E1DH:

LDB SENDTEMP, 30H

LCALL SENDTEMP2

L8E23H:

INCB 7CH

JNE L8E30H

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

LDB HEDZCLRED, #0FFH

L8E30H:

LD 30H, 32H

LD 32H, 00H

DIVU 30H, #0010H

ORB 30H, #30H

CMPB HEDZCLRED, #0FFH

JE L8E4AH

CMPB 30H, #30H

JE L8E50H

LDB HEDZCLRED, #0FFH

L8E4AH:

LDB SENDTEMP, 30H

LCALL SENDTEMP2

L8E50H:

INCB 7CH

JNE L8E5AH

LDB SENDTEMP, #2EH

LCALL SENDTEMP2

L8E5AH:

LDB 30H, 32H

ORB 30H, #30H

LDB SENDTEMP, 30H

LCALL SENDTEMP2

RET

LCALL L8E71H

LDB SENDTEMP, #2CH

LCALL SENDTEMP2

RET

L8E71H:

LD 38H, [40H]+

; 发送BIN2UART

SENDBIN:

LCALL BIN2BCD

LDB HEDZCLRED, 00H

LDB SENDTEMP, 34H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8E8BH

LCALL SENDTEMP2

L8E8BH:

LDB SENDTEMP, 33H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8E9CH

LCALL SENDTEMP2

L8E9CH:

LDB SENDTEMP, 32H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8EADH

LCALL SENDTEMP2

L8EADH:

LDB SENDTEMP, 31H

ORB SENDTEMP, #30H

LCALL CLR30

CMPB SENDTEMP, #20H

JE L8EBEH

LCALL SENDTEMP2

L8EBEH:

LDB SENDTEMP, 30H

ORB SENDTEMP, #30H

LCALL SENDTEMP2

RET

; 清除发送的导前0

CLR30:

CMPB HEDZCLRED, #0FFH

JE L8EDAH

CMPB SENDTEMP, #30H

JE L8ED7H

LDB HEDZCLRED, #0FFH

SJMP L8EDAH

L8ED7H:

LDB SENDTEMP, #20H

L8EDAH:

RET

LDB SETINDEX, #05H

L8EDEH:

LDB SENDTEMP, [40H]+

LCALL SENDTEMP2

DJNZ SETINDEX, L8EDEH

RET

; SEND E553 &CRC

SAYTRRTST:

NOP

CLRB 0BFH

LDB SENDTEMP, #0E5H

LCALL SENDTEMP2

LDB SENDTEMP, #53H

SCALL SENDTEMP2

LCALL sendf0crc

RET

发布评论

评论列表 (0)

  1. 暂无评论