⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sub.asm

📁 HT46R46 之应用-锂电池充电器
💻 ASM
字号:

cinitial: 

mmov pa,0ffh
mmov pac,03h
set pbc
clr pb
clr pwm
clr pdc
clr pd

mmov acsr,01h
mmov adcr,ch3+a0

mclear_ram
call stop_charging

mmov intc,00000101b
mmov tmr,(256-250)
mmov tmrc, 95h

mrled_on
mgled_on

call delay05s
call delay05s
call delay05s
mrled_off
mgled_off

ret

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

timer_isr:
push

timer_isr_ap:

inc time_4ms
inc charging_cx

mjneq time_4ms,250,timer_isr_exit
clr wdt1
clr time_4ms
inc time_1s
inc led_1s


timer_isr_t_2:

mov a,led_cx
and a,07h
addm a,pcl
jmp led_cx_a_isr
jmp led_cx_0_isr
jmp led_cx_1_isr
jmp led_cx_2_isr
jmp led_cx_3_isr
jmp led_cx_4_isr
jmp led_cx_4_isr
jmp led_cx_4_isr

timer_isr_exit_1:

mjneq led_1s,5,timer_isr_exit_3

;set one_min_flag
clr led_1s

timer_isr_exit_3:


mjneq time_1s,240,timer_isr_exit
clr time_1s
inc time_1min
inc charging_time_min
set one_min_flag

timer_isr_exit:
pop


led_cx_0_isr:

set pa.7
set pa.6
set pa.5

mcplb pa.4

jmp timer_isr_exit_1


led_cx_1_isr:

set pa.7
set pa.6
clr pa.4

mcplb pa.5

jmp timer_isr_exit_1

led_cx_2_isr:

set pa.7
clr pa.5
clr pa.4

mcplb pa.6

jmp timer_isr_exit_1

led_cx_3_isr:

clr pa.6
clr pa.5
clr pa.4

mcplb pa.7

jmp timer_isr_exit_1


led_cx_4_isr:

clr pa.7
clr pa.6
clr pa.5
clr pa.4

jmp timer_isr_exit_1


led_cx_a_isr:

set pa.7
set pa.6
set pa.5
set pa.4

jmp timer_isr_exit_1


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

madcon_macro_sub:

clr buf0
clr buf1

madcon_temp_lp:

mmov acsr,01h
mpolling_eoc

mov a,adrh
xor a,buf1
snz z
jmp madcon_temp2
jmp madcon_temp_end

madcon_temp2:

mmov buf1,adrh
jmp madcon_temp_lp

madcon_temp_end:
ret


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
delay0:

mmov buf1,01h
clr buf0

delay0_lp:

sdz buf0
jmp delay0_lp
sdz buf1
jmp delay0_lp
clr wdt2
ret


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

delay05s:

clr buf1
clr buf0

delay05s_lp:

sdz buf0
jmp delay05s_lp
sdz buf1
jmp delay05s_lp
clr wdt2
ret

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

delay1s:

mmov buf2,02h
clr buf1
clr buf0

delay1s_lp:

sdz buf0
jmp delay1s_lp
sdz buf1
jmp delay1s_lp
sdz buf2
jmp delay1s_lp
clr wdt2
ret

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -