"); //-->
org 00h
nop
nop
nop
nop
nop
nop
jmp main ;到主程序
org 0bh ;定时器0入口地址
jmp zdcl
reti
org 13h
nop
nop
nop
reti
org 1bh
nop
nop
nop
reti
org 1bh
nop
nop
nop
reti
org 30h
temp equ 20h
yfjc equ 30h
jpjc equ 31h
qzmjc equ 32h
jpmjc equ 33h
yfzjc equ 34h
yf_h equ 35h
yf_l equ 36h
temp1 equ 37h
temp2 equ 38h
temp3 equ 39h
temp4 equ 3ah
temp5 equ 3bh
yfdz equ 3ch
emcjc1 equ 51h
emcjc2 equ 52h
emcjc3 equ 53h
main: nop
nop
nop
mov emcjc1,#10h
mov emcjc2,#10h
mov emcjc3,#10h
mov p1,#0efh ;p1=1110 1111
mov p3,#0fh ;p3=0000 1111
mov sp,#60h ;堆栈60
clr ea ;禁止中断
clr et0
clr tr0
mov temp,#00h
mov r0,#00h
mov r1,#00h
mov r2,#00h
mov r3,#00h
mov r4,#00h
mov r5,#00h
mov r6,#00h
mov r7,#00h
nop
nop
nop
call sy4 ;调用声音
nop
nop
nop
loop0: jb p3.2,loop0 ;检测是否有按开关键
call ds10ms
jb p3.2,loop0
asd1: jnb p3.2,asd1
clr p1.3 ;开机,预设为强档,无定时?强档指示
setb p3.5
setb p3.7
nop
nop
nop
call sy4
nop
nop
nop
start: mov r0,#02h ;4h 6h
loope: mov r1,#02h ;2h 3h
loopd: mov r2,#06h ;1h #09h ;1.5h
loopc: mov r3,#64h ;10min
loopb: mov r4,#0C6h ;5999.999us
loopa: jb p3.3,loop1 ;可否有水
call ds10ms
jb p3.3,loop1
setb p1.1 ;有水
setb p3.5
jmp loop2
loop1: call ds10ms
jnb p3.3,loop2
clr p3.5 ;无水
clr p1.1
mov 40h,r1
mov 41h,r2
mov 42h,r3
mov 43h,r6
mov 44h,r7
mov 49h,#00h
jmp yinwue ;到音乐程序
nop
nop
nop
jmp main
loop2: jb p3.0,loop3 ;强弱开关
call ds10ms
jb p3.0,loop3
call sy4
jb temp.0,loop4
setb temp.0
clr p1.2 ;置弱档
clr p3.7
setb p1.3
jmp loop3
loop4: clr temp.0
setb p1.2
clr p1.3
setb p3.7 ;置强档
loop3: jb p3.1,loop5 ;可否有按定时键
call ds10ms
jb p3.1,loop5
call sy4
jb temp.1,loop6
jb temp.2,loop7
jb temp.3,loop8
clr p1.5
setb temp.1
mov r0,#02h ;4h
mov r1,#02h ;2h
mov r2,#06h ;1h
mov r3,#64h ;10min
mov r4,#0C6h
jmp loop5
loop6: jb temp.2,loop7
jb temp.3,loop8
setb p1.5
clr p1.6
clr temp.1
setb temp.2
mov r0,#02h ;4h
mov r1,#02h ;2h
mov r2,#06h ;1h
mov r3,#64h ;10min
mov r4,#0C6h
jmp loop5
loop7: jb temp.3,loop8
setb p1.6
clr p1.7
clr temp.2
setb temp.3
mov r0,#02h
mov r0,#02h ;4h
mov r1,#02h ;2h
mov r2,#06h ;1h
mov r3,#64h ;10min
mov r4,#0C6h
jmp loop5
loop8: clr temp.3
clr temp.4
setb p1.7
loop5: jb p3.2,loop9 ;可否有按ON/OFF键
call ds10ms
jb p3.2,loop9
zxv0: jnb p3.2,$
jmp main
loop9: call ds10ms
call ds10ms
djnz r4,hg1
jmp jkl1
hg1: nop
nop
nop
mov a,emcjc1
add a,emcjc2
add a,emcjc3
cjne a,#30h,emc_ret
jmp loopa
emc_ret:nop
nop
nop
jmp main
jkl1: jnb temp.1,loopg
cjne r2,#01h,loopg
call sy4
loopg: djnz r3,hg2
jmp jkl2
hg2: jmp loopb
jkl2: djnz r2,hg3
jmp jkl3
hg3: jmp loopc
jkl3: jnb temp.1,cby3
call sy4
jmp main ;1h定时时间到
cby3: jnb temp.2,acby3
clr temp.2
setb temp.1
setb p1.6
clr p1.5
acby3: djnz r1,hg4
jmp jkl4
hg4: jmp loopd
jkl4: jnb temp.2,cby4
call sy4
jmp main ;2小时时间到
cby4: jnb temp.3,acby4
setb p1.7
clr p1.6
clr temp.3
setb temp.2
acby4: jnb temp.3,acby5
setb temp.2
clr temp.3
setb p1.7
clr p1.6
acby5: djnz r0,hg5
jmp jkl5
hg5: jmp loope
jkl5: jnb temp.3,cby5
call sy4
jmp main ;4小时时间到
cby5: jmp start ;无定时,一直加湿
nop
nop
nop
jmp main
sy4: nop ;2KHZ
nop
nop
mov r7,#0ffh
sya: nop
nop
nop
call ds05ms
setb p3.4
nop
nop
nop
call ds05ms
clr p3.4
djnz r7,sya
clr p3.4
ret
nop
nop
nop
jmp main
ds05ms: nop
nop
nop
MOV R6,#12H
ZX: NOP
mov a,emcjc1
add a,emcjc2
add a,emcjc3
cjne a,#30h,emcret0
DJNZ R6,ZX
ret
emcret0:nop
nop
nop
jmp main
ds10ms: nop
nop
nop
MOV R6,#0AH
ZXV: MOV R7,#25H
GF: nop
nop
mov a,emcjc1
add a,emcjc2
add a,emcjc3
cjne a,#30h,emcret
DJNZ R7,GF
DJNZ R6,ZXV
RET
emcret: nop
nop
nop
jmp main
yinwue: mov temp1,#00h
mov temp2,#00h
mov temp3,#00h
mov temp4,#00h
mov temp5,#00h
mov yfjc,#00h
mov jpjc,#00h
mov qzmjc,#00h
mov jpmjc,#00h
mov yfzjc,#00h
mov yf_h,#00h
mov yf_l,#00h
mov yfdz,#00h
mov r1,#00h
mov r2,#00h
mov r3,#00h
mov r6,#00h
mov r7,#00h
inc 49h
mov a,49h
cjne a,#04h,lpp
jmp main
lpp: mov a,r7
mov dptr,#qz ;曲值地址
lp1: movc a,@a+dptr
mov yfjc,a ;取音符加值
cjne a,#00h,loopok
jmp yinwue
nop
nop
nop
jmp main
loopok: inc r7
mov a,r7
movc a,@a+dptr;取节拍值
mov jpjc,a
loop: mov dptr,#qz ;取参数值
inc r7
mov a,r7
movc a,@a+dptr
mov qzmjc,a
cjne a,#00h,loopx
inc r7
jmp lpp
nop
nop
nop
jmp main
loopx: mov a,qzmjc
anl a,#0fh
mov jpmjc,a
mov a,qzmjc
swap a
anl a,#0fh
cjne a ,#0fh,g01
jmp g02
g01: rl a
mov yfzjc,a
add a,yfjc
mov yfdz,a
mov dptr,#yf_box
movc a,@a+dptr
mov yf_h,a
mov th0,yf_h
inc yfdz
mov a,yfdz
movc a ,@a+dptr
mov yf_l,a
mov tl0,yf_l
mov tmod,#01h
setb ea
setb et0
setb tr0
g02: jmp ysms
ysmret: clr ea
clr et0
clr tr0
jmp loop
nop
nop
nop
jmp main
ysms: mov r3,jpmjc
ys8: mov r1,jpjc
ys4: mov r2,#0a7h
ys3: jb p3.2,ysm1
clr ea
clr et0
clr tr0
call ds10ms
jb p3.2,ysma
jnb p3.2,$
clr p3.4
jmp main
ysma: setb ea
setb et0
setb tr0
ysm1: jb p3.3,ysm2
clr ea
clr et0
clr tr0
call ds10ms
jb p3.3,ysmb
mov r1,40h
mov r2,41h
mov r3,42h
mov r6,43h
mov r7,44h
clr p3.4
setb p3.5
setb p1.1
jmp loop2
ysmb: setb ea
setb et0
setb tr0
ysm2: djnz r2,ys3
djnz r1,ys4
djnz r3,ys8
jmp ysmret ;ret
nop
nop
nop
jmp main
zdcl: clr ea
cpl p3.4
mov th0,yf_h
mov tl0,yf_l
setb ea
reti
nop
nop
nop
jmp main
yf_box: db 0fdh,083h ;262hz,.1
db 0fdh,0c9h ;294hz,.2
db 0feh,006h ;330hz,.3
db 0feh,022h ;349hz,.4
db 0feh,056h ;392hz,.5
db 0feh,085h ;440hz,.6
db 0feh,0adh ;493hz,.7
db 0feh,0c1h ;523hz,1
db 0feh,0dfh ;578hz,2
db 0ffh,003h ;659hz,3
db 0ffh,011h ;698hz,4
db 0ffh,02bh ;784hz,5
db 0ffh,042h ;880hz,6
db 0ffh,057h ;988hz,7
db 0ffh,060h ;1046hz,1.
db 0ffh,072h ;1175hz,2.
db 0ffh,081h ;1318hz,3.
db 0ffh,088h ;1397hz,4.
db 0ffh,095h ;1568hz,5.
db 0ffh,0a1h ;1760hz,6.
db 0ffh,0abh ;1976hz,7.
qz: db 16h ;生日快乐-音符起始值
db 3eh ;速度节拍值 4/4=125MS 3/4=187MS 2/4=250MS
db 03h,01h,14h,04h,34h,28h,03h,01h,14h,04h,44h,38h,03h,01h
db 74h,54h,34h,24h,14h,63h,61h,54h,34h,44h,38h
db 0f8h,0f8h,0f8h
DB 00H
DB 08H ;两只老虎-音符起始值
DB 29H ;速度节拍值
DB 34H,44H,54H,34H,34H,44H,54H,34H,54H,64H,78H,54H,64H,78H
DB 72H,82H,72H,62H,54H,34H,72H,82H,72H,62H,54H,34H,44H,74H
DB 38H,44H,04H,38H
db 0f8h,0f8h,0f8h
DB 00H
DB 08H ;世上只有妈妈好*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。