📄 mc68hc08as20.asm
字号:
mov a,#49h
lcall txd8861
lcall rxd8861
MOV A,#0FEH
LCALL TXD8861
LCALL RXD8861
MOV A,#1DH
LCALL TXD8861
LCALL RXD8861
MOV A,#00H
LCALL TXD8861
LCALL RXD8861
lcall delay6ms
INC r2
CJNE r2,#00H,EJINWEI2 ;判断低地址是否加到进位
INC r1
EJINWEI2: DJNZ R4,EREDATAA2
Eronlyr32: mov a,r6
jz Ereend2
DEC R6
MOV A,R6
XRL A,#0FFH
JZ EREEND2
LJMP EREDATA2
NOP
Ereend2:
mov a,#55h
lcall output
mov A,#0ffh ;擦除结束
lcall output
ANL P4,#0FDH
lcall delay200ms
ORL P4,#02h ;蜂鸣器
SETB CTRL ;适配器断电
lcall delayms
SETB CTRLDIR
lcall delayms
ORL P4,#04H ;中间busy灯灭
LJMP FUWEI
EREDATAA2: LJMP EREDATA2
;*****************************ERASE 4430 BAUD**************************************
ERA4430:
mov a,#55h ;波特率配置正确
lcall output
clr rst
lcall delay15ms
setb rst
lcall delay6ms
mov r0,#08h ;8 个00 安全位
TT300: mov a,#00h
lcall txd4430
lcall rxd4430
lcall delay15ms
djnz r0,TT300
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 EREDATA3
LJMP Eronlyr33
EREDATA3: lcall delay1ms
mov a,#49h
lcall txd4430
lcall rxd4430
MOV A,#0FEH
LCALL TXD4430
LCALL RXD4430
MOV A,#1DH
LCALL TXD4430
LCALL RXD4430
MOV A,#0CH
LCALL TXD4430
LCALL RXD4430
lcall delay6ms
lcall delay3ms
MOV A,#49H
LCALL TXD4430
LCALL RXD4430
MOV A,r1 ;TRANSMIT ADDRESS TO MCU
LCALL txd4430
lcall rxd4430
MOV A,r2
LCALL txd4430
lcall rxd4430
MOV A,#00H
LCALL TXD4430
LCALL RXD4430
lcall delay6ms
lcall delay3ms
mov a,#49h
lcall txd4430
lcall rxd4430
MOV A,#0FEH
LCALL TXD4430
LCALL RXD4430
MOV A,#1DH
LCALL TXD4430
LCALL RXD4430
MOV A,#0DH
LCALL TXD4430
LCALL RXD4430
lcall delay6ms
lcall delay3ms
mov a,#49h
lcall txd4430
lcall rxd4430
MOV A,#0FEH
LCALL TXD4430
LCALL RXD4430
MOV A,#1DH
LCALL TXD4430
LCALL RXD4430
MOV A,#0CH
LCALL TXD4430
LCALL RXD4430
lcall delay6ms
lcall delay3ms
mov a,#49h
lcall txd4430
lcall rxd4430
MOV A,#0FEH
LCALL TXD4430
LCALL RXD4430
MOV A,#1DH
LCALL TXD4430
LCALL RXD4430
MOV A,#00H
LCALL TXD4430
LCALL RXD4430
lcall delay6ms
lcall delay3ms
INC r2
CJNE r2,#00H,EJINWEI3 ;判断低地址是否加到进位
INC r1
EJINWEI3: DJNZ R4,EREDATAA3
Eronlyr33: mov a,r6
jz Ereend3
DEC R6
MOV A,R6
XRL A,#0FFH
JZ EREEND3
LJMP EREDATA3
NOP
Ereend3:
mov a,#55h
lcall output
mov A,#0ffh ;擦除结束
lcall output
ANL P4,#0FDH
lcall delay200ms
ORL P4,#02h ;蜂鸣器
SETB CTRL ;适配器断电
lcall delayms
SETB CTRLDIR
lcall delayms
ORL P4,#04H ;中间busy灯灭
LJMP FUWEI
EREDATAA3: LJMP EREDATA3
;*****************************用专用串口配置的波特率子程序***************************
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 delay1ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay90us
lcall delay90us
MOV A,#0FEH
LCALL TXDbaud
LCALL RXDbaud
LCALL DELAY1MS
MOV A,#1DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay90us
lcall delay90us
MOV A,#0CH
LCALL TXDbaud
LCALL RXDbaud
;lcall delay15ms
lcall delay3ms
MOV A,#49H
LCALL TXDbaud
LCALL RXDbaud
lcall delay90us
lcall delay90us
MOV A,r1 ;TRANSMIT ADDRESS TO MCU
LCALL txdbaud
lcall rxdbaud
LCALL DELAY1MS
MOV A,r2
LCALL txdbaud
lcall rxdbaud
lcall delay90us
lcall delay90us
MOV A,#00H
LCALL TXDbaud
LCALL RXDbaud
;lcall delay15ms
lcall delay3ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay90us
lcall delay90us
MOV A,#0FEH
LCALL TXDbaud
LCALL RXDbaud
LCALL DELAY1MS
MOV A,#1DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay90us
lcall delay90us
MOV A,#0DH
LCALL TXDbaud
LCALL RXDbaud
;lcall delay15ms
lcall delay3ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay90us
lcall delay90us
MOV A,#0FEH
LCALL TXDbaud
LCALL RXDbaud
LCALL DELAY1MS
MOV A,#1DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay90us
lcall delay90us
MOV A,#0CH
LCALL TXDbaud
LCALL RXDbaud
;lcall delay15ms
lcall delay3ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay90us
lcall delay90us
MOV A,#0FEH
LCALL TXDbaud
LCALL RXDbaud
LCALL DELAY1MS
MOV A,#1DH
LCALL TXDbaud
LCALL RXDbaud
lcall delay90us
lcall delay90us
MOV A,#00H
LCALL TXDbaud
LCALL RXDbaud
lcall delay3ms
;lcall delay15ms
INC r2
CJNE r2,#00H,EJINWEI4 ;判断低地址是否加到进位
INC r1
EJINWEI4: DJNZ R4,EREDATAA4
Eronlyr34: mov a,r6
jz Ereend4
DEC R6
MOV A,R6
XRL A,#0FFH
JZ EREEND4
LJMP EREDATA4
NOP
Ereend4:
mov a,#55h
lcall output
mov A,#0ffh ;擦除结束
lcall output
ANL P4,#0FDH
lcall delay200ms
ORL P4,#02h ;蜂鸣器
SETB CTRL ;适配器断电
lcall delayms
SETB CTRLDIR
lcall delayms
ORL P4,#04H ;中间busy灯灭
LJMP FUWEI
EREDATAA4: LJMP EREDATA4
;*****************************写EEPROM******************************************************
;begin write eeprom ***********************************************************************************
wrteep:
lcall pintest
CLR CTRLDIR
lcall delayms
CLR CTRL ;适配器供电
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
mov dlct,#0ffh
redelay2: lcall delay15ms
djnz dlct,redelay2
;*******************用普通IO口模拟串口配置波特率*****************************88
CLR RST
LCALL DELAY15MS
SETB RST
LCALL DELAY6MS
lcall delayms
MOV A,#55H
LCALL TXD28800
LCALL RXD28800
MOV DATAS,A
; lcall output
MOV A,DATAS
XRL A,#55H
JNZ W144
LJMP WRT28800
W144: ORL P4, #04H ;中间的BUSY灯灭
lcall delayms
CLR RST
LCALL DELAY15MS
SETB RST
LCALL DELAY6MS
lcall delayms
ANL P4, #0FBH ;中间的BUSY灯亮
lcall delayms
MOV A,#55H
LCALL TXD14400
LCALL RXD14400
MOV DATAS,A
;lcall output
mov a,datas
XRL A,#55H
JNZ W88
LJMP WRT14400
W88: ORL P4, #04H ;中间的BUSY灯灭
lcall delayms
CLR RST
LCALL DELAY15MS
SETB RST
lcall delay6ms
lcall delayms
ANL P4, #0FBH ;中间的BUSY灯亮
lcall delayms
MOV A,#55H
LCALL TXD8861
LCALL RXD8861
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -