📄 hilon.asm
字号:
ldb axl,[cx]+
cmpb r0,ykdoing
jne not_modi_relay_time
cmpb axl,#0ffh
je set_null_linkrelay
ldb RLI,linkrelayI
ldb RLLowU,linkrelayLowU
ldb RLOverU,linkrelayOverU
ldb RLF,linkrelayF
ldb RLPF,linkrelayPF
stb axl,RLI[dx]
call relay_check_set
jbsm rlcheckf,md_link_relay_data_error
ljmp do_modify_suc
set_null_linkrelay:
stb axl,linkrelayI[dx]
ljmp do_modify_suc
;-------------------------------------------------------
relay_check_set:
rlcheckf set tmpflag
clrbit rlcheckf
cmpb RLI,#0ffh
je relay_check_set01
cmpb RLI,#00
je relay_check_set01
setbit rlcheckf
ret
relay_check_set01:
cmpb RLLowU,#0ffh
je relay_check_set02
cmpb RLLowU,#01
je relay_check_set02
setbit rlcheckf
ret
relay_check_set02:
cmpb RLOverU,#0ffh
je relay_check_set02_a
cmpb RLOverU,#04h
jc relay_check_set02_end
cmpb RLOverU,RLI
je relay_check_set02_end
cmpb RLOverU,RLLowU
jne relay_check_set02_a
sjmp relay_check_set02_end
relay_check_set02_a:
cmpb RLF,#0ffh
je relay_check_set03
cmpb RLF,#04
jc relay_check_set02_end
cmpb RLF,RLI
je relay_check_set02_end
cmpb RLF,RLLowU
je relay_check_set02_end
cmpb RLF,RLOverU
jne relay_check_set03
relay_check_set02_end:
setbit rlcheckf
ret
relay_check_set03:
cmpb RLPF,#0ffh
je relay_check_set04
cmpb RLPF,#04
jc relay_check_set03_end
cmpb RLPF,RLI
je relay_check_set03_end
cmpb RLPF,RLLowU
je relay_check_set03_end
cmpb RLPF,RLOverU
je relay_check_set03_end
cmpb RLPF,RLF
jne relay_check_set04
relay_check_set03_end:
setbit rlcheckf
ret
relay_check_set04:
stb RLI,linkrelayI
ldb RLI,linkrelayLowU
cmpb RLI,RLLowU
je not_need_process_low_voltage_relay
stb RLLowU,linkrelayLowU
cmpb RLLowU,#0ffh
jne low_voltage_process_00
andb yk,#0fdh ; open the second relay
call yk_exe_output
sjmp not_need_process_low_voltage_relay
low_voltage_process_00:
orb yk,#02h ; close the second relay
call yk_exe_output
not_need_process_low_voltage_relay:
stb RLOverU,linkrelayOverU
stb RLF,linkrelayF
stb RLPF,linkrelayPF
ret
;---------------------------------------------------------------
modify_inputfunc_set:
ldb axl,reclen
cmpb axl,#inputfunc_len
jne md_inputfunc_data_error
ld bx,#inputfunc
ldb axh,#08
save_input_func:
ldb axl,[cx]+
cmpb axl,#01
jh md_inputfunc_data_error
stb axl,[bx]+
djnz axh,save_input_func
ljmp do_modify_suc
md_inputfunc_data_error:
ljmp do_modify_dataerr
;----------------------------------------------------------------
clear_part_energy:
; clear part of quantity of electricity
setbit crcpassf
ldb axl,reclen
cmpb axl,#set0_len
jne exit_clear_part
ldb bxl,[cx]
cmpb bxl,#06 ; wpa,wpb,wpc,wqa,wqb,wqc
jc exit_clear_part
shlb bxl,#02
clrb bxh
st r0,energy_buf[bx]
st r0,energy_buf+2[bx]
st r0,eng_sum_buf[bx]
st r0,eng_sum_buf+2[bx]
ljmp do_modify_suc
exit_clear_part:
sjmp do_modify_dataerr
;----------------------------------------------------------------
answer_remote_pulse:
ldb axl,reclen
cmpb axl,#short_ask_len
jne short_ask_ym_error
ld sndpt,#sndadd
ldb sndlen,#32
ld dx,#pulse_buf
st r0,cx
;
answer_pulse_count_01:
ld ax,[dx]+
ld bx,[dx]+
cmpb r0,inputfunc[cx]
jne answer_pulse_count_02
stb r0,[sndpt]+ ; if the channel input yx,not including pulse count
stb r0,[sndpt]+
stb r0,[sndpt]+
stb r0,[sndpt]+
sjmp answer_pulse_count_03
answer_pulse_count_02:
stb bxh,[sndpt]+
stb bxl,[sndpt]+
stb axh,[sndpt]+
stb axl,[sndpt]+
answer_pulse_count_03:
inc cx
cmp cx,#07
jnh answer_pulse_count_01
;
ljmp do_answer_ending
short_ask_ym_error:
ljmp short_ask_data_error
;----------------------------------------------------------------
modify_dead_zone_value:
setbit crcpassf
ldb axl,reclen
cmpb axl,#set0_len
jne exit_md_dead_zone
ldbze axl,[cx]
cmpb axl,#100
jh exit_md_dead_zone
stb axl,dead_zone
call autosending_yc_set
ljmp do_modify_suc
exit_md_dead_zone:
sjmp do_modify_dataerr
;----------------------------------------------------------------
clr_part_remote_pulse:
setbit crcpassf
ldb axl,reclen
cmpb axl,#set0_len
jne exit_clr_part_pulse
ldbze axl,[cx]
cmpb axl,#07
jh exit_clr_part_pulse
shl ax,#02
st r0,pulse_buf[ax]
st r0,pulse_buf+2[ax]
ljmp do_modify_suc
exit_clr_part_pulse:
sjmp do_modify_dataerr
;----------------------------------------------------------------
answer_module_normal_name:
ldb sndlen,#17
; bmovm sndpt,#normal_name,#8 ; can't use this style for byte start
ld ax,#normal_name
ld bxl,#16
answer_name_loop:
ldb bxh,[ax]+
stb bxh,[sndpt]+
djnz bxl,answer_name_loop
ljmp do_answer_ending
;----------------------------------------------------------------
answer_module_sequence_num:
ldb sndlen,#13
; bmovm sndpt,#hdware_edition,#6 ; can't use this style for byte start
ld ax,#hdware_edition
ld bxl,#12
answer_sequence_num_loop:
ldb bxh,[ax]+
stb bxh,[sndpt]+
djnz bxl,answer_sequence_num_loop
ljmp do_answer_ending
;----------------------------------------------------------------
answer_dead_zone_value:
ldb sndlen,#02
ldb bxl,dead_zone
stb bxl,[sndpt]+
ljmp do_answer_ending
;----------------------------------------------------------------
modify_module_sequence_num:
setbit crcpassf
ldb axl,reclen
cmpb axl,#seq_num_len
jne exit_md_seq_number
ld bx,#hdware_edition
ldb axh,#12
save_sequence_num:
ldb axl,[cx]+
cmpb axl,#'0'
jnc exit_md_seq_number
cmpb axl,#'9' ; #####????
jh exit_md_seq_number
stb axl,[bx]+
djnz axh,save_sequence_num
ljmp do_modify_suc
exit_md_seq_number:
ljmp do_modify_dataerr
;----------------------------------------------------------------
return_debug_msg:
; return message to make sure received correct,just for debug
ldb funccode,#7fh
stb r0,masaddr
ldb axl,#01
stb axl,[sndpt]+
ldb sndlen,axl
sjmp do_answer_ending
;================================================================
do_answer_ending:
ld sndpt,#sndadd
stb masaddr,objectaddr
jbsm brdcastf,exit_without_answer
call can_send
ret
exit_without_answer:
clrbit brdcastf
clrbit rec_readyf
ret
;--------------------------------------------------------
do_modify_suc:
ld sndpt,#sndadd
ldb bxl,#stat_set_normal
stb bxl,[sndpt]
sjmp do_modify_end_com
do_modify_dataerr:
clrbit crcpassf
ld sndpt,#sndadd
ldb bxl,#stat_data_err
stb bxl,[sndpt]
sjmp do_modify_end_com
do_modify_funcerr:
clrbit crcpassf
ld sndpt,#sndadd
ldb bxl,#stat_func_err
stb bxl,[sndpt]
sjmp do_modify_end_com
do_modify_oper_fail:
clrbit crcpassf
ld sndpt,#sndadd
ldb bxl,#stat_oper_fail
stb bxl,[sndpt]
sjmp do_modify_end_com
do_modify_end_com:
ldb sndlen,#01h
ld sndpt,#sndadd
stb masaddr,objectaddr
ldb funccode,#stat_insure
jbsm brdcastf,exit_without_answer
jbcm crcpassf,exit_without_save
call can_send
setbit saveflashf
call save_csboot0
ret
exit_without_save:
call can_send
ret
;--------------------------------------------------------
judge_yc_autosending:
jbcm autosendf,judge_yc_send_fail
jbsm yc_forbidf,judge_yc_send_fail
jbcm autosendycf,judge_yc_send_fail
sjmp judge_yc_autosend_00
judge_yc_send_fail:
ret
judge_yc_autosend_00:
clrbit autosendycf
ldb axl,systemtype
cmpb axl,#sys3p4w1ct
jh judge_yc_3p3w
ld cx,#ua ; 3p4w only judge line_n voltage
ld dx,#uarem
sjmp judge_yc1_autosend
judge_yc1_ask_end:
ljmp judge_ask_important_yc
judge_yc_3p3w:
ld cx,#uab ; 3p3w only judge line_line voltage
ld dx,#uabrem
judge_yc1_autosend:
ld fx,u_zone
ldb exl,#03
judge_yc_3p3w_voltage:
ld ax,[cx]+
ld bx,[dx]+
cmp ax,bx
jh judge_yc_3p3w_01
sub ax,bx,ax
sjmp judge_yc_3p3w_02
judge_yc_3p3w_01:
sub ax,bx
judge_yc_3p3w_02:
cmp ax,fx
jh judge_yc1_ask_end
djnz exl,judge_yc_3p3w_voltage
ld cx,#ia
ld dx,#iarem
ld fx,i_zone
ldb exl,#03
judge_yc1_current:
ld ax,[cx]+
ld bx,[dx]+
cmp ax,bx
jh judge_yc_3p3w_03
sub ax,bx,ax
sjmp judge_yc_3p3w_04
judge_yc_3p3w_03:
sub ax,bx
judge_yc_3p3w_04:
cmp ax,fx
jh judge_ask_important_yc
djnz exl,judge_yc1_current
ld ax,in
ld bx,inrem
cmp ax,bx
jh judge_yc_3p3w_05
sub ax,bx,ax
sjmp judge_yc_3p3w_06
judge_yc_3p3w_05:
sub ax,bx
judge_yc_3p3w_06:
ld fx,i_zone
cmp ax,fx
jh judge_ask_important_yc
ld ax,freq
cmp r0,ax
je freq_need_judge_autosend
cmp ax,#low_freq_limit
jnh not_need_judge_freq_autosend
cmp ax,#high_freq_limit
jh not_need_judge_freq_autosend
freq_need_judge_autosend:
ld bx,freqrem
cmp ax,bx
jh judge_yc_3p3w_07
sub ax,bx,ax
sjmp judge_yc_3p3w_08
judge_yc_3p3w_07:
sub ax,bx
judge_yc_3p3w_08:
ld fx,f_zone
cmp ax,fx
jh judge_ask_important_yc
not_need_judge_freq_autosend:
ld ax,pf
ld bx,cosrem
cmp ax,bx
jh judge_yc_3p3w_09
sub ax,bx,ax
sjmp judge_yc_3p3w_0a
judge_yc_3p3w_09:
sub ax,bx
judge_yc_3p3w_0a:
cmp ax,pf_zone
jnh judge_yc2_autosend
judge_ask_important_yc:
bmovm #uabrem,#uab,#9
ld ax,in
st ax,inrem
ld ax,freq
st ax,freqrem
ld ax,pf
st ax,cosrem
call apply_ask_important_yc
ret
judge_yc2_autosend:
ld cx,#wfpowl
ld dx,#wfpowreml
ld gx,p_zonel
ld hx,p_zoneh
ldb axl,#02
judge_yc2_power:
push ax
ld ax,[cx]+
ld bx,[cx]+
ld ex,[dx]+
ld fx,[dx]+
cmpl ax,ex
jh judge_autosend_yc2_01
sub ax,ex,ax
subc fx,bx
ld bx,fx
sjmp judge_autosend_yc2_02
judge_autosend_yc2_01:
sub ax,ex
subc bx,fx
judge_autosend_yc2_02:
cmpl ax,gx
jh judge_ask_yc2_for_power
pop ax
djnz axl,judge_yc2_power
sjmp judge_yc3_autosend
judge_ask_yc2_for_power:
pop ax
bmovm #wfpowrem,#wfpowl,#4
call apply_ask_common_yc
ret
judge_yc3_autosend:
ldb axl,systemtype
cmpb axl,#sys3p4w1ct
jnh judge_autosend_yc3_01
ret
judge_yc3_ask_end:
ljmp judge_ask_subordinate_yc
judge_autosend_yc3_01:
ld cx,#freqa
ld dx,#freqarem
ld fx,f_zone
ldb exl,#03
judge_yc3_frequent:
ld ax,[cx]+
ld bx,[dx]+
cmp ax,bx
jh judge_autosend_yc3_02
sub ax,bx,ax
sjmp judge_autosend_yc3_03
judge_autosend_yc3_02:
sub ax,bx
judge_autosend_yc3_03:
cmp ax,fx
jh judge_yc3_ask_end
djnz exl,judge_yc3_frequent
ld cx,#pfa
ld dx,#cosarem
ld fx,pf_zone
ldb exl,#03
judge_yc3_powerfactor:
ld ax,[cx]+
ld bx,[dx]+
cmp ax,bx
jh judge_autosend_yc3_04
sub ax,bx,ax
sjmp judge_autosend_yc3_05
judge_autosend_yc3_04:
sub ax,bx
judge_autosend_yc3_05:
cmp ax,fx
jh judge_yc3_ask_end
djnz exl,judge_yc3_powerfactor
ld cx,#power_buf
ld dx,#wfpowarem
ld gx,p_zonel
st hx,p_zoneh
ldb axl,#06
judge_yc3_power:
push ax
ld ax,[cx]+
ld bx,[cx]+
ld ex,[dx]+
ld fx,[dx]+
cmpl ax,ex
jh judge_autosend_yc3_06
sub ax,ex,ax
subc fx,bx
ld bx,fx
sjmp judge_autosend_yc3_07
judge_autosend_yc3_06:
sub ax,ex
subc bx,fx
judge_autosend_yc3_07:
cmpl ax,gx
jh apply_ask_for_power
pop ax
djnz axl,judge_yc3_power
ret
apply_ask_for_power:
pop ax
judge_ask_subordinate_yc:
bmovm #freqarem,#freqa,#06
bmovm #wfpowarem,#power_buf,#12
call apply_ask_subordinate_yc
ret
;--------------------------------------------------------
do_modify_ending_debug:
ld sndpt,#sndadd
ld recpt,#recadd
ldb bxl,reclen
do_md_debug_01:
ldb bxh,[recpt]+
stb bxh,[sndpt]+
djnz bxl,do_md_debug_01
ld sndpt,#sndadd
ldb bxl,reclen
stb bxl,sndlen
stb masaddr,objectaddr
jbsm brdcastf,exit_without_answer_00
call can_send
ret
exit_without_answer_00:
ljmp exit_without_answer
;================================================================
; END END END END END
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -