用AT89C2051单片机制作水族箱加氧泵自控开关源程序
扫描二维码
随时随地手机看文章
以下程序已实际调试运行通过)
; ---AT89C2051加氧泵控制器源程序-OK!
org 0000h
ajmp main
nop
org 01bh
clr tr1
ajmp timon
org 30h
main:mov 40h,#00h
mov 41h,#00h
mov 42h,#00h
mov 43h,#02h
mov 44h,#00h
mov 45h,#00h
mov 46h,#00h
mov 4ah,#02h
mov 4bh,#00h
mov 4ch,#01h
mov 4dh,#05h
nca equ 48h
ncb equ 49h
mov p3,#0ffh
mov sp,#50h
mov tmod,#10h
mov ie,#88h
mov tl1,#46h
mov th1,#76h
clr nca
clr ncb
setb tr1
clr p3.7
disp:;------显示-------
mov r3,46h
cjne r3,#1,ct
mov dptr,#tab
clr p3.2
mov a,42h
movc a,@a+dptr
anl p1,#01h
orl p1,a
jb ncb,xsb
setb p3.3
lcall ms10
xsb: acall key
clr p3.3
jb nca,ys1
mov a,43h
movc a,@a+dptr
anl p1,#01h
orl p1,a
setb p3.2
ys1: lcall ms10
ajmp disp
ct: mov dptr,#tab
clr p3.2
mov a,42h
movc a,@a+dptr
anl p1,#01h
orl p1,a
jb ncb,xsd
setb p3.3
lcall ms10
xsd: acall key
clr p3.3
jb nca,ys2
mov a,43h
movc a,@a+dptr
anl p1,#01h
orl p1,a
setb p3.2
ys2: lcall ms10
ajmp disp
timon:;定时计数中断子程序--
setb rs0
push psw
push aCC
mov tl1,#46h
mov th1,#76h
setb tr1
inc 40h
mov r0,40h
cjne r0,#8,tim
mov 40h,#00h
cpl p1.0
t11: inc 41h
mov r0,41h
cjne r0,#60,tim
mov 41h,#00h
mov r0,42h
cjne r0,#00,tia
ajmp tib