;*****************************************************
;Company :
;File Name : sevev.asm
;Author :
;Create Data : 2009-08-14
;Last Modified : 2009-08-14
;Description :
;Version : 1.0
;*****************************************************
;*****************************
list p=6612
;*****************************
ie equ 00h
irq equ 01h
tmod equ 02h
tmod1 equ 03h
tl0 equ 04h
th0 equ 05h
tl1 equ 06h
th1 equ 07h
inx equ 0fh
dpl equ 10h
dpm equ 11h
dph equ 12h
setting equ 13h
hlm_ace equ 14h
pa equ 08h
pb equ 09h
pc equ 0ah
duty equ 15h
tbr equ 0eh
sec_1 equ 20h
sec_2 equ 21h
min_1 equ 22h
min_2 equ 24h
temp equ 25h
flag equ 26h
m_flag equ 27h
s_flag equ 28h
ct0 equ 29h
ct1 equ 2ah
ct2 equ 2bh
ct3 equ 2ch
pb_bak equ 30h
org 00
jmp r_start
org 01h
rtni
org 02h
jmp time0
org 03h
jmp time1
org 04h
jmp pbc
;***********************************
org 0100h
time0:
lda flag
ba1 sec
orim flag,010b
jmp intend
sec:
andim m_flag,01
ba0 WW
orim pa,0110b ;eorim pa,0110b
call delay
andim pa,0 ;
;+++++++++++++++++++++++++++++++++
WW:
andim flag,000b
adim sec_1,01h
daa sec_1
ldi temp,0h
adcm sec_2,00h
;***********************
sbi sec_2,03
bnz wait ;30sec ?
andim m_flag,01
bnz setflag
;***********************
wait:
sbi sec_2,06
baz min
jmp intend
min:
ldi sec_2,0
adim min_1,01h
daa min_1
ldi temp,0h
;++++++++++1min++time+++++;EV_test mode
; sbi min_1,01
; bnz intend
;++++++++++30/60min++time++;work mode
adcm min_2,00h
sbi min_2,06h
bnz intend
;++++++++++++++++++++++++++++++
orim m_flag,01
jmp intend
setflag:
orim s_flag,01
intend:
ldi ie,0100b
ldi irq,0
rtni
;***************************
time1:
rtni
;***************************
pbc:
ldi irq,0
rtni
;****************************
r_start:
nop
nop
nop
ldi tbr,0
ldi sec_1,0
ldi sec_2,0
ldi min_1,0
ldi min_2,0
ldi ct0,0
ldi ct1,0
ldi ct2,0
ldi flag,0
ldi s_flag,0
ldi m_flag,0
ldi pa,0
ldi pb,1111b
ldi pb_bak,0
ldi duty,00h
ldi setting,00h
ldi hlm_ace,0
ldi tmod,011b
ldi tl0,00h
ldi th0,08h
; jmp key_scan
;+++++++++++++++++++++++++++++
mode_stop:
ldi m_flag,0
ldi s_flag,0
ldi min_2,0
ldi pa,0h;
ldi tmod,011b
ldi tl0,00h
ldi th0,08h
ldi irq,0
ldi ie,0001b
stop
nop
nop
;***************************
key_scan:
lda pb
sta pb_bak
sbi pb_bak,1111b
baz key_scan
call delay_k
lda pb
sub pb_bak
bnz key_scan
eor pb_bak
ba1 $+2 ;key_1
jmp key_1
ba2 $+2 ;key_2
jmp key_2
jmp key_scan
key_1:
ldi ie,0100b
ldi irq,0
ldi min_2,03h
jmp main
key_2:
ldi ie,0100b
ldi irq,0
ldi min_2,06h
;***************************************
main:
andim m_flag,01;after '30
ba0 mode_two
jmp main
mode_two:
ldi pa,1111b
nop
nop
orim pa,1101b
andim s_flag,01 ;after 30s
ba0 mode_stop
jmp mode_two ;
;+++++++++++++++++++++++++++++
delay:
adim ct0,01h
bnc delay
adim 30h,05h
bnc delay
ldi 30h,0
rtni
delay_k:
ldi ct1,09
ldi ct2,0eh
sbi ct2,01h
bnc $-1
sbi ct1,01h
bnc $-4
rtni
;+++++++++++++++++++++++++++++
END