📄 mc68hc08ab32.asm
字号:
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,#00H
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
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
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
ANL P4,#0FBH
lcall delayms
lcall delayms
lcall delayms
ANL P4, #0FBH ;中间的BUSY灯亮
lcall delayms
; mov dlct,#0ffh
;redelay3: lcall delay15ms
; djnz dlct,redelay3
;*******************用专用串口配置波特率****************************
autobaudW:
ORL P4,#04H ;中间的BUSY灭
lcall delayms
CLR RST
LCALL DELAY15MS
SETB RST
lcall delay6ms
lcall delayms
ANL P4, #0FBH ;中间的BUSY灯亮
lcall delayms
MOV R0,#03H
TDb5: MOV A,R0 ;从表中取数据入累加器
MOVC a,@A+PC
JMP TDB6
DB 0eah, 0e7h, 0d5h, 0cdh
TDB6:
mov baud,a
mov a,#55h
LCALL txdbaud
lcall rxdbaud
mov auto,a
mov a,auto
xrl a,#55h
jz autoW
clr rst
lcall delay15ms
setb rst
lcall delay6ms
inc r0
cjne r0,#07h,tdb5
mov a,#0aah
lcall output
mov a,#0cch ;波特率没配对
lcall output
ANL P4,#0F7H ; 下边灯亮,报错,波特率没配置对
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
loopW: LJMP FUWEI
autoW: ljmp autoWRT ; 用专用串口配置的波特率子程序
;**************************用转用串口配置的波特率子程序***************************************
AUTOWRT:
mov a,#55h ;波特率配置正确
lcall output
clr rst
lcall delay15ms
setb rst
lcall delay6ms
mov r0,#08h ;8 个00 安全位
WTT400: mov a,#00h
lcall txdbaud
lcall rxdbaud
lcall delay15ms
djnz r0,WTT400
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
lcall delayms
mov a,#0bbh
lcall output; 芯片测试通过
;receive the data from pc to write
mov r4,lenl
mov r6,lenh
mov dptr,#0000h
mov a,r4
jz wonlyh4
wdatas4: lcall input
movx @dptr,a
inc dptr
djnz r4,wdatas4
wonlyh4: mov a,r6
jz write04
dec r6
mov a,r6
xrl a,#0ffh
jnz wdatas4
write04: nop
mov dptr,#0000h
mov r1,addh
mov r2,addl
mov r6,lenh
mov r4,lenl
mov a,r4
JNZ WDATA4
LJMP Wonlyr34
WDATA4: lcall delay1ms
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 delay6ms
lcall delay3ms
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 delay6ms
lcall delay3ms
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 delay6ms
lcall delay3ms
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,#00H
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
lcall delay3ms
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,#04H
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
lcall delay3ms
mov a,#49h
lcall txdbaud
lcall rxdbaud
lcall delay6ms
MOV A,r1
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
MOV A,r2
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
MOVx A,@dptr
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
lcall delay3ms
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,#05H
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
lcall delay3ms
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,#04H
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
lcall delay3ms
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,#00H
LCALL TXDbaud
LCALL RXDbaud
lcall delay6ms
lcall delay3ms
inc dptr
INC r2
CJNE r2,#00H,WJINWEI4 ;判断低地址是否加到进位
INC r1
WJINWEI4: DJNZ R4,WDATAA4
Wonlyr34: mov a,r6
jz Wend4
DEC R6
MOV A,R6
XRL A,#0FFH
JZ WEND4
LJMP WDATA4
NOP
Wend4: mov a,#55h
lcall output
mov a,#0ffh ;WRITE 结束
lcall output
ANL P4,#0FDH
lcall delay200ms
ORL P4,#02h ;蜂鸣器
ORL P4,#04H ;中间灯灭
SETB CTRL ;适配器断电
lcall delayms
SETB CTRLDIR
lcall delayms
LJMP FUWEI
WDATAA4: LJMP WDATA4
J_COFIG:
ANL P4,#0FEH
LCALL delay200ms
CLR RELAYSCK
CLR VCC12BACK ;relaycs = P1 ^ 6; 此脚复用
MOV CN,#08H
MOV JCONFIG_H,#30H
MOV JCONFIG_L,#0FH
MOV A,JCONFIG_L
CYCJL:
RRC A
MOV RELAYDIN,C
SETB RELAYSCK
CLR RELAYSCK
DJNZ CN,CYCJL
MOV CN,#08H
MOV A,JCONFIG_H
CYCJH:
RRC A
MOV RELAYDIN,C
SETB RELAYSCK
CLR RELAYSCK
DJNZ CN,CYCJH
SETB VCC12BACK
lcall delay200ms
ORL P4,#01H
lcall delay200ms
RET
;******************************************************************************************************************
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -