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

📄 dfg-a.asm

📁 采用samsung 9454做的电饭锅的小程序
💻 ASM
📖 第 1 页 / 共 4 页
字号:
;	every 4ms (normal mode,*TA int generation time can be changed manually)

;************************************************
T0_INT:          	;400us interrupt
                push    r1
                push    r0
                push    flags
                tm      p0pnd,#00000001b
                jp      nz,exint
;                tm      t0con,#00000010b
;                jp      z,ret_t0int
                tm      t0con,#00000001b
                jp      z,t0_int2
                
                cp      tzero,#250
                jr      ugt,t0_zero
                inc     tzero
t0_zero:
                inc     t_400us
                cp      t_400us,#5
                jr      ult,t0_int1
                clr     t_400us
                call    display
                
                cp      buzztime,#0
                jr      eq,t0_buz
                dec     buzztime
t0_buz
                inc     t_2ms
                cp      t_2ms,#51       ;2min/60min
                jr      ult,t0_int1
                clr     t_2ms
                or      flag,#f_100ms
t0_int1:
                ld      t0data,#160     ;200             ;4M osc 2ms int  400*4M/8=200
		ld	T0CON,#10000010b	;T0 int enable
;                and     T0CON,#00111110b
t0_int2:        pop     flags
                pop     r0
                pop     r1
                iret
;ret_t0int:		
;                ld          t0data,#200        ;4M osc 2ms int  400*4M/8=200
;		ld	    T0CON,#10001010b	;T0 int enable
;                pop     flags
;                iret
exint:
                and     p0pnd,#11111110b
                clr     tzero
                inc     t1s
                jr      t0_int2
;--------100ms interrupt-----
timer:
                tm      flag,#f_100ms
                jr      nz,time_inc
                ret
time_inc:
                and     flag,#fn_100ms
                
                inc     prtime
                
                tm      ledflag,#f_lock
                jr      z,time_dispt1
                ld      dispt,#00000111b
                clr     t600ms
                jr      time_dispt
time_dispt1
                inc     t600ms
                cp      t600ms,#6
                jr      ult,time_dispt
                clr     t600ms
                rcf
                rrc     dispt
time_dispt
                
                cp      key2s,#0                ;20*100ms=2s
                jr      eq,time_keyf
                dec     key2s
                or      ledflag,#f_ledf
                jr      time_keyf2
time_keyf
                and     ledflag,#fn_ledf
time_keyf2
                cp      key3s,#250
                jr      uge,time_key
                inc     key3s
time_key
                cp      t_100ms,#5
                jr      ult,flashset
                and     flag,#fn_flash
                jr      flash_end
flashset:
                or      flag,#f_flash
flash_end:
		inc	t_100ms
		cp	t_100ms,#10
		jr	ult,time_end
		clr	t_100ms
                
                cp      key3min,#0              ;180*1s=3min
                jr      eq,time_lock
                dec     key3min
                jr      time_lock2
time_lock
                or      ledflag,#f_lock
time_lock2
                or      flag,#f_wen
                and     keyflag,#fn_power
                cp      settime,#0
                jr      eq,set_end
                dec     settime
set_end:

        	inc	sec
                 cp     sec,#60         ;1  ;60                 ;cuttime 缩时 
                 jr     ult,time_end
                clr    sec
		
                  inc     t10min
                  
                cp      pausetime,#0
                jr      eq,pause_end
                dec     pausetime
pause_end:
  
		tm	status,#f_heats
		jr	nz,time_end

                
		inc	min
	         cp	min,#60
		jp	ult,time_end
		clr	min

		inc	hour
		cp	hour,#25
		jp	ult,time_end
        dec     hour
	;	clr	hour
time_end:
		ret
;************************************************
buzz
        ld      PWMCON,#00001100b       ;eable
        ld      buzztime,#100   ;200ms
        ret
buzzcon
        cp      buzztime,#0
        jr      ne,buzzcon1
        ld      PWMCON,#00h   ;disable
buzzcon1
        ret
;*************************************************
prcon
                tm      status,#f_heats
                jr      z,prcon_int
                cp      wendu,#w60
                jr      ugt,prcon_int
                cp      wendu,#w150
                jr      ult,prcon_end
                cp      prtime,#50      ;5s
                jr      ult,prcon_end
                clr     prtime
                ld      r0,prtwendu
                sub     r0,wendu
                cp      r0,#15          ;温度上升多少?
                jr      ult,prcon_water
                and     ledflag,#fn_water
                ld      prwendu,#w400
                jr      prcon_int
prcon_water
                or      ledflag,#f_water 
                cp      wenduset,#w300
                jr      ule,prcon_h
                ld      prwendu,#w150
                jr      prcon_int
prcon_h
                ld      prwendu,#w220
                jr      prcon_int
prcon_int
                clr     prtime
                ld      prtwendu,wendu
prcon_end
                ret
;*************************************************
statuscon:
                cp      settime,#0
                jr      ne,sta_end
                and     flag,#fn_start
                and     flag2,#fn_setw
                and     flag2,#fn_setd
                and     flag2,#fn_seth
                tm      status,#f_stop
                jr      nz,sta_end
                tm      status,#f_holds
                jr      nz,sta_hold
                tm      status,#f_heats
                jr      nz,sta_heat
                tm      status,#f_delay
                jr      nz,sta_delay
                
                clr     min
                clr     hour
                or      status,#f_delay
                ret
sta_hold:
                tm      flag2,#f_hs
                jr      z,sta_hold2
                and     flag2,#fn_hs
                or      status,#f_heats
                and     status,#fn_holds
                ret
sta_hold2:
                cp      holdset,min     ;hour
                jr      ugt,sta_end
                and     status,#fn_holds
                or      status,#f_stop
                ret
sta_heat:            
                cp      wenduset,prwendu
                jr      ugt,sta_heata
                ld      r0,prwendu
                jr      sta_heatb
sta_heata
                ld      r0,wenduset
sta_heatb
           ;     cp      wendu,wenduset  ;温度越高,ad直越小 
           ;     jr      uge,sta_heat2	;sta_end 
                cp      r0,wendu         ;温度越高,ad直越小 
                jr      ule,sta_heat2	;sta_end 
                
                and     status,#fn_heats
                or      status,#f_holds
                ld      pausetime,#15           ;stop 15Min
                clr     t10min 
	    tm	flag2,#f_heat2
	    jr	nz,sta_end
	    or	flag2,#f_heat2
                clr     min
                clr     hour

                ret
sta_heat2:
		ld      pausetime,#15           ;stop 15Min
		ret
sta_delay:
                cp      delayset,hour
                jr      ugt,sta_end
                and     status,#fn_delay
                or      status,#f_heats
                ret   
sta_end:
                ret

;************************************************
control:
                tm      status,#f_run
                jp      z,clrgate
                tm      flag,#f_wendu_f
                jp      nz,clrgate
                tm      status,#f_heats
                jr      nz,con_heat
                ;cp      pausetime,#0
                ;jp      ne,clrgate
                tm      status,#f_holds
                jr      nz,con_hold
                jp      clrgate
con_heat:
                cp      tzero,#2
                jp      ult,setgate
                cp      tzero,#t_h      ;25
                jp      ult,clrgate     ;setgate
                cp      tzero,#30
                jp      ugt,clrgate
                jp      setgate ;clrgate
con_hold:
                cp      wenduset,prwendu
                jr      ugt,con_holda
                ld      r0,prwendu
                jr      con_holdb
con_holda
                ld      r0,wenduset
con_holdb

                cp      r0,wendu
                jp      uge,clrgate
            
;==========2007-12-2============
                ;cp      wenduset,#175   ;设定80度以下,用一个功率加热
                ;jr      ugt,con_wa 
                ld      t_w,#5          ;工作周期 
                ld      t_all,#44         ;总周期 
                jp      con_we 
con_wa: 
                cp      t10min,#10      ;10分钟控制一次
                jr      ult,con_we
                clr     t10min
                cp      wendu,#185      ;85du以上 
                jr      ult,con_wb
                ld      t_w,#5          ;工作周期 
                ld      t_all,#44         ;总周期 
                jp      con_we 
con_wb: 
                cp      wendu,#180      ;82.5du-85度 
                jr      ult,con_wc 
                ld      t_w,#5          ;工作周期 
                ld      t_all,#36         ;总周期 
                jp      con_we 
con_wc:
                cp      wendu,#175      ;80du-82.5度 
                jr      ult,con_wd 
                ld      t_w,#5          ;工作周期 
                ld      t_all,#30         ;总周期 
                jp      con_we  
con_wd:                                 ;80度以下 
                ld      t_w,#5          ;工作周期 
                ld      t_all,#26         ;总周期 
                jp      con_we 
con_we:
                cp      t1s,t_w         ;
                jr      ult,con_heat
                cp      t1s,t_all       ;
                jp      ult,clrgate
                clr     t1s
                ret  

;==========2007-12-2============            

setgate:
                or      p0,#b_gate
                ret
clrgate:
                and     p0,#bn_gate
                ret

;************************************************

;************************************************

;************************************************
;显示处理 
discon:
      ;  jr diskey
                tm      status,#f_run
                jp      z,disnot
                tm      flag,#f_wendu_f
                jr      nz,dis_f
                tm      status,#f_stop
                jr      nz,dis00s
	     tm      flag2,#f_setw		;2007-10-31
             jp      nz,diswendu
             tm      flag2,#f_setd
                jr      nz,disdelay
                tm      flag2,#f_seth
                jr      nz,dishold
                
                tm      status,#f_holds
                jp      nz,dishold2
                
              ;  tm      flag2,#f_setw
              ;  jp      nz,diswendu
              ;  tm      flag2,#f_setd
              ;  jr      nz,disdelay
              ;  tm      flag2,#f_seth
              ;  jr      nz,dishold
                tm      flag,#f_start
                jr      nz,dis00
                tm      status,#f_delay
                jr      nz,disdelay2 
                jp      diswendu
           ;     jr      disad        ;test 

⌨️ 快捷键说明

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