📄 sub.asm
字号:
.public _MODEL
.var _MODEL=0
.var _WHICH_TIME=0
.code
.public _Set
_Set:.proc
r3=[_MODEL]
r3+=1
[_MODEL]=r3
cmp r3,0x06
jne s_select
r3=0x01
[_MODEL]=r3
s_select:
r2=0x01
[_LED_FLASH_STATUS]=r2
r1=[_MODEL]
cmp r1,0x01
je s_exit1
cmp r1,0x02
je s_exit2
cmp r1,0x03
je s_exit3
cmp r1,0x04
je s_exit4
r1=0
[_WHICH_TIME]=R1
r1=voice_bw
[_Announce_Buff]=r1
call _PlayRespond
jmp s_exit
s_exit1:
r1=0
[_WHICH_TIME]=R1
r1=voice_cool
[_Announce_Buff]=r1
call _PlayRespond
jmp s_exit
s_exit2:
r1=0
[_WHICH_TIME]=R1
r1=voice_fcool
[_Announce_Buff]=r1
call _PlayRespond
jmp s_exit
s_exit3:
r1=0
[_WHICH_TIME]=R1
r1=voice_bz
[_Announce_Buff]=r1
call _PlayRespond
jmp s_exit
s_exit4:
r1=voice_dt
[_Announce_Buff]=r1
call _PlayRespond
r2=0x00
delay_loop1:
r1=0x00
delay_loop2:
r1+=1
cmp r1,0xffff
jne delay_loop2
r2+=1
cmp r2,0x0F
jne delay_loop1
r1=voice_time
[_Announce_Buff]=r1
call _PlayRespond
r1=0x01
[_WHICH_TIME]=r1
s_exit:
retf
.endp
//*******************************************//
// 空锅报警子程序 /
//*******************************************//
.iram
.var _Announced=0x00 //报警是否已播放过的状态号//
.code
.public _Empty
_Empty:.proc
r1=[_Announced]
cmp r1,0x00
jne e_exit
r1=voice_alarm
[_Announce_Buff]=r1
call _PlayRespond
e_exit:
r1=0x01
[_Announced]=r1
retf
.endp
//***************************************************//
// 计时加预置子程序 //
//***************************************************//
.public _Time_up
_Time_up:.proc
r1=[_WHICH_TIME]
cmp r1,0x01
je timeup2
call _Time_up1_sub
jmp time_exit_up
timeup2: call _Time_up2_sub
time_exit_up:
r1=voice_up
[_Announce_Buff]=r1
call _PlayRespond
retf
.endp
//*******************************************************//
// 预置1设定加子程序 //
//*******************************************************//
.public _Time_up1_sub
_Time_up1_sub: .proc
r1=[T1_1] //取第一个数据//
cmp r1,1 //判断是否为1//
jne set_time1_go //不为1则加数//
r1+=[T1_2]
cmp r1,3
je sub1_exit_up
set_time1_go: r1=[T1_3] //取第三个数据//
cmp r1,5 //判断是否到了5//
jne sub1_exit_5 //不到5跳转//
r2=0 //到5后写0//
[T1_3]=r2
r1=[T1_2] //取第二个数据//
cmp r1,9 //比较是否到了9//
jne sub1_exit_9 //不到9跳转加1//
r2=0 //到9后写0//
[T1_2]=r2
r2=[T1_1]
r2+=1
[T1_1]=r2
jmp sub1_exit_up
sub1_exit_9: r2=[T1_2]
r2+=1
[T1_2]=r2 //加1操作//
jmp sub1_exit_up
sub1_exit_5: r2=[T1_3]
r2+=1
[T1_3]=r2 //加1操作//
sub1_exit_up: retf
.endp
//*******************************************************//
// 预置2设定加子程序 //
//*******************************************************//
.public _Time_up2_sub
_Time_up2_sub: .proc
r1=[T2_1] //取第一个数据//
cmp r1,1 //判断是否为3//
je set_time2_go //不为1则加数//
r1+=[T1_2]
cmp r1,3
je sub1_exit_up
set_time2_go: r1=[T2_3] //取第三个数据//
cmp r1,5 //判断是否到了5//
jne sub2_exit_5 //不到5跳转//
r2=0 //到5后写0//
[T2_3]=r2
r1=[T2_2] //取第二个数据//
cmp r1,9 //比较是否到了9//
jne sub2_exit_9 //不到9跳转加1//
r2=0 //到9后写0//
[T2_2]=r2
r2=[T2_1]
r2+=1
[T2_1]=r2
jmp sub2_exit_up
sub2_exit_9: r2=[T2_2]
r2+=1
[T2_2]=r2 //加1操作//
jmp sub1_exit_up
sub2_exit_5: r2=[T2_3]
r2+=1
[T2_3]=r2 //加1操作//
sub2_exit_up: retf
.endp
//***************************************************//
// 计时减预置子程序 //
//***************************************************//
.public _Time_down
_Time_down:.proc
r1=[_WHICH_TIME]
cmp r1,0x01
je timedown2
call _Time_down1_sub
jmp time_exit_down
timedown2:
call _Time_down2_sub
time_exit_down:
r1=voice_down
[_Announce_Buff]=r1
call _PlayRespond
retf
.endp
//*******************************************************//
// 预置1设定减子程序 //
//*******************************************************//
.public _Time_down1_sub
_Time_down1_sub: .proc
r1=[T1_1] //取第一个数据//
r1+=[T1_2] //第一个数据和第二个数据相加//
r1+=[T1_3] //前三个数据相加//
cmp r1,0
je sub1_exit_down
r1=[T1_3] //取第三个数据//
cmp r1,0 //判断是否到了0//
jne sub1_exit_05 //不到0跳转//
r2=5 //到5后写0//
[T1_3]=r2
r1=[T1_2] //取第二个数据//
cmp r1,0 //比较是否到了0//
jne sub1_exit_09 //不到0跳转减1//
r2=9 //到0后写9//
[T1_2]=r2
r2=[T1_1]
r2-=1
[T1_1]=r2
jmp sub1_exit_down
sub1_exit_09: r2=[T1_2]
r2-=1
[T1_2]=r2 //减1操作//
jmp sub1_exit_down
sub1_exit_05: r2=[T1_3]
r2-=1
[T1_3]=r2 //减1操作//
sub1_exit_down: retf
.endp
//*******************************************************//
// 预置2设定减子程序 //
//*******************************************************//
.public _Time_down2_sub
_Time_down2_sub: .proc
r1=[T2_1] //取第一个数据//
r1+=[T2_2] //第一个数据和第二个数据相加//
r1+=[T2_3] //前三个数据相加//
cmp r1,0
je sub2_exit_down
r1=[T2_3] //取第三个数据//
cmp r1,0 //判断是否到了0//
jne sub2_exit_05 //不到0跳转//
r2=5 //到5后写0//
[T2_3]=r2
r1=[T2_2] //取第二个数据//
cmp r1,0 //比较是否到了0//
jne sub2_exit_09 //不到0跳转减1//
r2=9 //到0后写9//
[T2_2]=r2
r2=[T2_1]
r2-=1
[T2_1]=r2
jmp sub2_exit_down
sub2_exit_09: r2=[T2_2]
r2-=1
[T2_2]=r2 //减1操作//
jmp sub2_exit_down
sub2_exit_05: r2=[T2_3]
r2-=1
[T2_3]=r2 //减1操作//
sub2_exit_down: retf
.endp
//********************************************//
// 煮饭子程序 //
//********************************************//
.public _COOL
_COOL:.proc
r1=1
[cool_status]=r1
cool_test1:
r1=[_Tempreature_value]
cmp r1,537 //是否到了50度//
ja cool_test1 //大于537即小于50度时循环//
r1=0
[cool_status]=r1
cool_test2:
r1=[_Tempreature_value]
cmp r1,687 //是否到了40度//
jbe cool_test2 //小于等于687即大于40度时循环//
cool_test5:
r1=1
[cool_status]=r1
cool_test3:
r1=[_Tempreature_value]
cmp r1,140
jae cool_test3 //大于140即小于98度时循环等待//
r1=0
[cool_status]=r1
cool_test4:
r1=[_Tempreature_value]
cmp r1,68 //小于68即大于等于125度时跳出//
jbe cool_exit
cmp r1,144 //大于97度时停止加热等待,小于时循环加热//
jb cool_test4
jmp cool_test5
cool_exit:
r1=[_Tempreature_value]
cmp r1,132 //大于100度时停止加热等待,否则继续加热//
jbe cool_exit
r1=1
[cool_status]=r1
cool_test6:
r1=[_Tempreature_value]
cmp r1,77 //大于120度时加热结束//
ja cool_test6
r1=0
[cool_status]=r1
r1=voice_ok
[_Announce_Buff]=r1
call _PlayRespond
r1=0x0105
[P_INT_Ctrl]=r1 //初始化中断//
int fiq,irq //开中断//
retf
.endp
//*********************************************//
// 快煮子程序 //
//********************************************//
.public _FCOOL
_FCOOL:.proc
fcool_test3:
r1=1
[cool_status]=r1
fcool_test1:
r1=[_Tempreature_value]
cmp r1,140
ja fcool_test1
r1=0
[cool_status]=r1
fcool_test2:
r1=[_Tempreature_value]
cmp r1,68
jbe fcool_exit
jmp fcool_test3
fcool_exit:
r1=0
[cool_status]=r1
r1=voice_ok
[_Announce_Buff]=r1
call _PlayRespond
r1=0x0105
[P_INT_Ctrl]=r1 //初始化中断//
int fiq,irq //开中断//
retf
.endp
//********************************************//
// 煲粥子程序 //
//********************************************//
.public _BZ
_BZ:.proc
r1=0
[T2_1]=r1
r1=0
[T2_2]=r1
r1=5
[T2_3]=r1
r1=0
[T2_4]=r1
bz_test3:
r1=[T2_1]
r1+=[T2_2]
r1+=[T2_3]
r1+=[T2_4]
cmp r1,0
je bz_exit
r1=1
[cool_status]=r1
bz_test1:
r1=[_Tempreature_value]
cmp r1,140
jae bz_test1
r1=0
[cool_status]=r1
bz_test2:
r1=[_Tempreature_value]
cmp r1,144
jb bz_test2
jmp bz_test3
bz_exit:
r1=voice_ok
[_Announce_Buff]=r1
call _PlayRespond
r1=0x0105
[P_INT_Ctrl]=r1 //初始化中断//
int fiq,irq //开中断//
r1=0
[cool_status]=r1
retf
.endp
//********************************************//
// 炖汤子程序 //
//********************************************//
.public _DT
_DT:.proc
r1=1
[cool_status]=r1
dt_test1:
r1=[T2_1]
r1+=[T2_2]
r1+=[T2_3]
r1+=[T2_4]
cmp r1,0 //判断是否计时器2计时结束//
jne dt_test1
r1=voice_ok
[_Announce_Buff]=r1
call _PlayRespond
r1=0x0105
[P_INT_Ctrl]=r1 //初始化中断//
int fiq,irq //开中断//
r1=0
[cool_status]=r1
retf
.endp
//********************************************//
// 保温子程序 //
//********************************************//
.public _BW
_BW:.PROC
r1=[P_IOB_Buffer]
r1&=0xF083
r1|=0x0080
[P_IOB_Data]=r1 //保温功能指示灯常亮//
bw_test1:
r1=[_Tempreature_value]
cmp r1,370
jbe bw_test1
r1=1
[cool_status]=r1
bw_test2:
r1=[_Tempreature_value]
cmp r1,340
jae bw_test2
r1=0
[cool_status]=r1
jmp bw_test1
retf
.endp
//*******************************************//
// 烹调开始子程序 //
//*******************************************//
.public _Start_cancle
_Start_cancle:.proc
r1=0
[_WHICH_TIME]=r1 //选择显示时钟//
r1=[_MODEL]
cmp r1,0x00
jne start
r1=voice_set
[_Announce_Buff]=r1
call _PlayRespond //提示设定功能//
retf
start: r1=voice_start
[_Announce_Buff]=r1
call _PlayRespond
r1=0x0105
[P_INT_Ctrl]=r1 //初始化中断//
int fiq,irq //开中断//
r1=1
[_STATUS]=r1 //置开机标志//
r1=0
[_LED_FLASH_STATUS]=r1 //LED停闪//
r1=[_MODEL]
cmp r1,0x01
je on_1
cmp r1,0x02
je on_2
cmp r1,0x03
je on_3
cmp r1,0x04
je on_4
cmp r1,0x05
je on_5
on_1: r1=[P_IOB_Buffer]
r1&=0xF00B
r1|=0x0008
[P_IOB_Data]=r1 //煮饭功能指示灯常亮//
jmp start_loop
on_2: r1=[P_IOB_Buffer]
r1&=0xF013
r1|=0x0010
[P_IOB_Data]=r1 //快煮功能指示灯常亮//
jmp start_loop
on_3: r1=[P_IOB_Buffer]
r1&=0xF023
r1|=0x0020
[P_IOB_Data]=r1 //煲粥功能指示灯常亮//
jmp start_loop
on_4: r1=[P_IOB_Buffer]
r1&=0xF043
r1|=0x0040
[P_IOB_Data]=r1 //炖汤功能指示灯常亮//
jmp start_loop
on_5: r1=[P_IOB_Buffer]
r1&=0xF083
r1|=0x0080
[P_IOB_Data]=r1 //保温功能指示灯常亮//
start_loop: r1=[T1_1]
r1+=[T1_2]
r1+=[T1_3]
r1+=[T1_4]
cmp r1,0x00
jne start_loop
r1=[_MODEL] //读设定值//
cmp r1,1
je start_model1
cmp r1,2
je start_model2
cmp r1,3
je start_model3
cmp r1,4
je start_model4
start_model5: call _BW
jmp start_exit
start_model1: call _COOL
jmp start_model5
start_model2: call _FCOOL
jmp start_model5
start_model3: call _BZ
jmp start_model5
start_model4: call _DT
jmp start_model5
start_exit: retf
.endp
//***********************************************//
// 主程序 //
//***********************************************//
.code
.public _main
_main:
call _System_Initial
loop: r1=0x0105
[P_INT_Ctrl]=r1 //初始化中断//
int fiq,irq //开中断//
call _KeyScan
cmp r1,0x0011
je exit1
cmp r1,0x0012
je exit2
cmp r1,0x0014
je exit3
cmp r1,0x0018
je exit4
test r1,0x0010
jz exit5
jmp exit
exit1:call _Set
jmp exit
exit2:call _Time_up
jmp exit
exit3:call _Time_down
jmp exit
exit4:call _Start_cancle
jmp exit
exit5:call _Empty
exit: jmp loop
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -