;**********************************************
; 红外按键处理
;**********************************************
mn_ifred_key:
event: mov a,rxdata
cmprs a,#0d0h
jmp _ifred_key10
bset kflag.1
_ifred_key10:
cmprs a,#0c0h
jmp _ifred_key20
bset kflag.2
_ifred_key20:
cmprs a,#0c1h
jmp _ifred_key30
bset kflag.3
_ifred_key30:
cmprs a,#0c4h
jmp _ifred_key40
bset kflag.4
_ifred_key40:
cmprs a,#0c8h
jmp _ifred_key50
bset kflag.6
_ifred_key50:
cmprs a,#0c2h
jmp _ifred_key90
bset kflag.5
_ifred_key90:
clr rxdata
ret
;**********************************************
; 报警检测
;**********************************************
mnalarm_test:
mov a,zhengshuA
sub a,alarmA
bts1 fc
jmp alarm_test10 ;没到报警温度
bset buzz1 ;到了报警温度
bset motf1
bclr time_ok.1
jmp alarm_test11
alarm_test10:
bclr buzz1
alarm_test11:
mov a,zhengshuB
sub a,alarmB
bts1 fc
jmp alarm_test20 ;没到报警温度
bset buzz2 ;到了报警温度
bset motf2
bclr time_ok.2
jmp alarm_test21
alarm_test20:
bclr buzz2
alarm_test21:
mov a,zhengshuC
sub a,alarmC
bts1 fc
jmp alarm_test30 ;没到报警温度
bset buzz3 ;到了报警温度
bset motf3
bclr time_ok.3
jmp alarm_test90
alarm_test30:
bclr buzz3
alarm_test90:
ret
;**********************************************
; 报警
;**********************************************
mnbuzz_out:
bts1 buzz1
jmp buzz_out10
jmp buzz_out30
buzz_out10:
bts1 buzz2
jmp buzz_out20
jmp buzz_out30
buzz_out20:
bts1 buzz3
jmp buzz_out90
jmp buzz_out30
buzz_out30:
incms buzzcnt
mov a,buzzcnt
cmprs a,#125 ;0.5s高,0.5s低
jmp buzz_out90
mov a,#00010000b
xor p5,a
buzz_out90:
ret
;**********************************************
; 电机控制:电机启动后,运行5min 停转
;**********************************************
mnmot_control:
bts1 motf1
jmp mot_control20
bts1 time_ok.1
jmp mot_control10
jmp mot_control20
mot_control10:
bset mot1
incms motcnt10
mov a,motcnt10
cmprs a,#250
jmp mot_control21
clr motcnt10 ;1s
incms motcnt11
mov a,motcnt11
cmprs a,#60
jmp mot_control21
clr motcnt11 ;1min
incms motcnt12
mov a,motcnt12
cmprs a,#5
jmp mot_control21
clr motcnt12 ;5min
bset time_ok.1
bclr motf1
mot_control20:
bclr mot1
mot_control21:
bts1 motf2
jmp mot_control30
bts1 time_ok.2
jmp mot_control22
jmp mot_control30
mot_control22:
bset mot2
incms motcnt20
mov a,motcnt20
cmprs a,#250
jmp mot_control31
clr motcnt20 ;1s
incms motcnt21
mov a,motcnt21
cmprs a,#60
jmp mot_control31
clr motcnt21 ;1min
incms motcnt22
mov a,motcnt22
cmprs a,#5
jmp mot_control31
clr motcnt22 ;5min
bset time_ok.2
bclr motf2
mot_control30:
bclr mot2
mot_control31:
bts1 motf3
jmp mot_control90
bts1 time_ok.3
jmp mot_control40
jmp mot_control41
mot_control40:
bset mot3
incms motcnt30
mov a,motcnt30
cmprs a,#250
jmp mot_control90
clr motcnt30 ;1s
incms motcnt31
mov a,motcnt31
cmprs a,#60
jmp mot_control90
clr motcnt31 ;1min
incms motcnt32
mov a,motcnt32
cmprs a,#5
jmp mot_control90
clr motcnt32 ;5min
bset time_ok.3
bclr motf3
mot_control41:
bclr mot3
mot_control90:
ret
;**********************************************
; 蜂鸣器指示
;**********************************************
note:
bts1 note_flag
jmp note90
bset p5.4
incms note_cnt
mov a,note_cnt
cmprs a,#50
jmp note90
bclr p5.4
clr note_cnt
bclr note_flag
note90:
ret
;**********************************************
; P0.2 reset
;**********************************************
reset_pin:
bts1 p0.2
jmp reset_pin10
jmp reset_pin90
reset_pin10:
incms reset_cnt
mov a,reset_cnt
cmprs a,#15
jmp reset_pin90
clr reset_cnt
jmp reset
reset_pin90:
ret
;**********************************************
; 关com口
;**********************************************
com_off:
bclr com0
bclr com1
bclr com2
bclr com3
ret
;**********************************************
; 系统初始化
;**********************************************
sys_init:
mov a,#0ffh
mov p2m,a
mov p5m,a
bclr p0m.0
bset p5m.4
bset p1m.5
bset p1m.6
bset p1m.7
ret
;**********************led table*******************
table: ;共阴0 1 2 3 4 5 6 7 8 9 a b c d e f
dw 3fh,06h,5bh,4fh,66h,6dh,7dh,07h,7fh,6fh,77h,7ch,39h,5eh,79h,71h
xsu_tab: ;小数BCD查找表
dw 0000h,0625h,1250h,1875h
dw 2500h,3125h,3750h,4375h
dw 5000h,5625h,6250h,6875h
dw 7500h,8125h,8750h,9375h
zsu_tab: ;整数BCD查找表
dw 0000h,0001h,0002h,0003h,0004h,0005h,0006h,0007h
dw 0008h,0009h,0010h,0011h,0012h,0013h,0014h,0015h
dw 0016h,0017h,0018h,0019h,0020h,0021h,0022h,0023h
dw 0024h,0025h,0026h,0027h,0028h,0029h,0030h,0031h
dw 0032h,0033h,0034h,0035h,0036h,0037h,0038h,0039h
dw 0040h,0041h,0042h,0043h,0044h,0045h,0046h,0047h
dw 0048h,0049h,0050h,0051h,0052h,0053h,0054h,0055h
dw 0056h,0057h,0058h,0059h,0060h,0061h,0062h,0063h
dw 0064h,0065h,0066h,0067h,0068h,0069h,0070h,0071h
dw 0072h,0073h,0074h,0075h,0076h,0077h,0078h,0079h
dw 0080h,0081h,0082h,0083h,0084h,0085h,0086h,0087h
dw 0088h,0089h,0090h,0091h,0092h,0093h,0094h,0095h
dw 0096h,0097h,0098h,0099h,0100h,0101h,0102h,0103h
dw 0104h,0105h,0106h,0107h,0108h,0109h,0110h,0111h
dw 0112h,0113h,0114h,0115h,0116h,0117h,0118h,0119h
dw 0120h,0121h,0122h,0123h,0124h,0125h,0126h,0127h
endp |