📄 08ab32.asm
字号:
lcall delay69us
lcall delay158us
mov r3,#8 ;2
inrxd: mov c,rxd ;2
rrc a ;1
lcall delay158us ;4
djnz r3,inrxd ;3
jnb rxd,$ ;4
lcall delay158us
ret ;2
DELAY158US: MOV del1,#05H ;3个30.1us
D158us1: MOV R7,#67H
D158us2: DJNZ R7,D158us2 ;3个机器周期
DJNZ del1,D158us1
RET
TXDBAUD:
CLR C
MOV txd,C
LCALL DELAY158us
MOV R3,#8 ;2
outtxdb: RRC A ;1
MOV txd,C ;2 3 3 3
LCALL DELAY158us ;4 1.5 1.5 1.5
DJNZ R3,outtxdb;2 2 2 2
SETB C ;1 3 3 3
MOV txd,C ;2 3 3 3
LCALl DELAY158us ;2 1.5 1.5 1.5
RET ;2 3 3 3
;***********************************i/0 port is a txd and rxd port *************************************************
;14400***************************************************************************************
rxd14400: jb rxd,$
lcall delay35us
lcall delay69us
mov r3,#8 ;2
in144: mov c,rxd ;2
rrc a ;1
lcall delay69us ;4
djnz r3,in144 ;3
jnb rxd,$ ;4
lcall delay69us
ret ;2
delay35us: MOV R7,#74H
d35us: DJNZ R7,d35us ;3个机器周期
RET
delay69us: mov r7,#0e6h
d69us: djnz r7,d69us
ret
txd14400:
CLR C
MOV txd,C
LCALL DELAY69us
MOV R3,#8 ;2
out144: RRC A ;1
MOV txd,C ;2 3 3 3
LCALL DELAY69us ;4 1.5 1.5 1.5
DJNZ R3,out144 ;2 2 2 2
nop
SETB C ;1 3 3 3
MOV txd,C ;2 3 3 3
LCALl DELAY69us ;2 1.5 1.5 1.5
RET ;2 3 3 3
;28800***************************************************************************************
rxd28800: jb rxd,$
lcall delay17us
lcall delay34us
mov r3,#8 ;2
in288: mov c,rxd ;2
rrc a ;1
lcall delay34us ;4
djnz r3,in288 ;3
jnb rxd,$ ;4
lcall delay34us
ret ;2
delay34us: MOV R7,#71H
d34us: DJNZ R7,d34us ;3个机器周期
RET
delay17us: mov r7,#39h
d17us: djnz r7,d17us
ret
txd28800:
CLR C
MOV txd,C
LCALL DELAY34us
MOV R3,#8 ;2
out288: RRC A ;1
MOV txd,C ;2 3 3 3
LCALL DELAY34us ;4 1.5 1.5 1.5
DJNZ R3,out288 ;2 2 2 2
nop
SETB C ;1 3 3 3
MOV txd,C ;2 3 3 3
LCALl DELAY34us ;2 1.5 1.5 1.5
RET ;2 3 3 3
;8861***************************************************************************************
rxd8861: jb rxd,$
lcall delay56us
;lcall delay113us
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
mov r3,#8 ;2
in88: mov c,rxd ;2
rrc a ;1
;lcall delay113us ;4
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
djnz r3,in88 ;3
jnb rxd,$ ;4
;lcall delay113us
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ret ;2
delay56us: mov r7,#0bah
d56us: djnz r7,d56us
ret
txd8861:
CLR C
MOV txd,C
;LCALL DELAY113us
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
MOV R3,#8 ;2
out88: RRC A ;1
MOV txd,C ;2 3 3 3
;LCALL DELAY113us ;4 1.5 1.5 1.5
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
DJNZ R3,out88 ;2 2 2 2
nop
SETB C ;1 3 3 3
MOV txd,C ;2 3 3 3
;LCALl DELAY113us ;2 1.5 1.5 1.5
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
RET ;2 3 3 3
;4430***************************************************************************************
rxd4430: jb rxd,$
;lcall delay112us
LCALL DELAY56US
LCALL DELAY56US
;lcall delay225us
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LCALL DELAY56US
LCALL DELAY56US
mov r3,#8 ;2
in44: mov c,rxd ;2
rrc a ;1
;lcall delay225us ;4
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LCALL DELAY56US
LCALL DELAY56US
djnz r3,in44 ;3
jnb rxd,$ ;4
;lcall delay225us
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LCALL DELAY56US
LCALL DELAY56US
ret
txd4430:
CLR C
MOV txd,C
;LCALL DELAY225us
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LCALL DELAY56US
LCALL DELAY56US
MOV R3,#8 ;2
out44: RRC A ;1
MOV txd,C ;2 3 3 3
;LCALL DELAY225us ;4 1.5 1.5 1.5
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LCALL DELAY56US
LCALL DELAY56US
DJNZ R3,out44 ;2 2 2 2
nop
SETB C ;1 3 3 3
MOV txd,C ;2 3 3 3
;LCALl DELAY225us ;2 1.5 1.5 1.5
LCALL DELAY56US
LCALL DELAY56US
NOP
NOP
NOP
NOP
NOP
NOP
NOP
LCALL DELAY56US
LCALL DELAY56US
RET ;2 3 3 3
;***************************************ALL SUB PROGRAMMER END*******************************************************************
;begin of erase eeprom ******************************************************************************
;*******************************************ERASE**********************************************
;*****************************************************************************************************
erase:
lcall pintest
CLR CTRLDIR
lcall delayms
CLR CTRL ;适配器供电
lcall delayms
lcall delayms
lcall delayms
lcall delayms
ANL P4,#0FBH
lcall delayms
mov dlct,#0ffh
redelay2: lcall delay15ms
djnz dlct,redelay2
;*******************用专用串口配置波特率****************************
autobaudE:
ORL P4,#04H ;中间的BUSY灭
CLR RST
LCALL DELAY15MS
SETB RST
lcall delay6ms
lcall delayms
ANL P4,#0FBH ;中间的BUSY灯亮
MOV R0,#03H
TDb3: MOV A,R0 ;从表中取数据入累加器
MOVC a,@A+PC
JMP TDB4
DB 0eah, 0e7h, 0d5h, 0cdh
TDB4:
mov baud,a
mov a,#55h
LCALL txdbaud
lcall rxdbaud
mov auto,a
;LCALL OUTPUT
mov a,auto
xrl a,#55h
jz autoE
clr rst
lcall delay15ms
setb rst
lcall delay6ms
inc r0
cjne r0,#07h,tdb3
mov a,#0aah
lcall output
mov a,#0cch ;波特率没配对
lcall output
ANL P4,#0F7H ;中间的BUSY亮
ANL P4,#0FDH
lcall delay200ms
ORL P4,#02h ;蜂鸣器
lcall delay200ms
ANL P4,#0FDH
lcall delay200ms
ORL P4,#02h ;蜂鸣器
lcall delay200ms
ANL P4,#0FDH
lcall delay200ms
ORL P4,#02h ;蜂鸣器
SETB CTRL ;适配器断电
lcall delayms
SETB CTRLDIR
lcall delayms
loopE: LJMP FUWEI
autoE: ljmp autoERA ; 用专用串口配置的波特率子程序
;*****************************用专用串口配置的波特率子程序***************************
AUTOERA:
mov a,#55h ;波特率配置正确
lcall output
clr rst
lcall delay15ms
setb rst
lcall delay6ms
mov r0,#08h ;8 个00 安全位
TT400: mov a,#00h
lcall txdbaud
lcall rxdbaud
lcall delay6ms
djnz r0,TT400
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
mov a,#0bbh
lcall output ; 芯片测试通过
mov r1,addh
mov r2,addl
mov r6,lenh
mov r4,lenl
mov a,r4
JNZ EREDATA4
LJMP Eronlyr34
EREDATA4: lcall delay6ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay6ms
MOV A,#0FEH
LCALL TXDbaud
LCALL RXDbaud
LCALL DELAY6MS
MOV A,#1DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
MOV A,#0CH
LCALL TXDbaud
LCALL RXDbaud
lcall delay3ms
lcall delay6ms
MOV A,#49H
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
MOV A,r1 ;TRANSMIT ADDRESS TO MCU
LCALL txdbaud
lcall rxdbaud
LCALL DELAY6MS
MOV A,r2
LCALL txdbaud
lcall rxdbaud
lcall delay6ms
MOV A,#00H
LCALL TXDbaud
LCALL RXDbaud
lcall delay3ms
lcall delay6ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay6ms
MOV A,#0FEH
LCALL TXDbaud
LCALL RXDbaud
LCALL DELAY6MS
MOV A,#1DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
MOV A,#0DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay3ms
lcall delay6ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay6ms
MOV A,#0FEH
LCALL TXDbaud
LCALL RXDbaud
LCALL DELAY6MS
MOV A,#1DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
MOV A,#0CH
LCALL TXDbaud
LCALL RXDbaud
lcall delay3ms
lcall delay6ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -