《用单片机制作电池容量测试源程序》由会员分享,可在线阅读,更多相关《用单片机制作电池容量测试源程序(2页珍藏版)》请在金锄头文库上搜索。
1、org 0000h ajmp start org 0bh ajmp timer ;初始化 start: mov tmod,#01h mov th0,#15h mov tl0,#9fh mov ie,#82h mov r0,#0fh mov r1,#0fh mov r2,#0fh mov r3,#50 mov r4,#60 s1:jnb p3.6,$ acall delay jnb p3.6,s1 clr p3.0 setb tr0 ;显示数据 display:mov p1,r0 clr p3.3 acall delay setb p3.3 mov p1,r1 clr p3.4 acall de
2、lay setb p3.4 mov p1,r2 clr p3.5 acall delay setb p3.5 ajmp display ;定时中断服务子程序 timer:mov th0,#15h mov tl0,#9fh djnz r3,tm4 mov r3,#50 jb p3.6,tm1 acall delay jb p3.6,tm1 clr tr0 clr p3.7 setb p3.0ajmp tm4 tm1:djnz r4,tm4 mov r4,#60 cjne r0,#9fh,tm2 mov r0,#0fh cjne r1,#9fh,tm3 mov r1,#0fh mov a,r2 add a,#10h mov r2,a ajmp tm4 tm2:mov a,r0 add a,#10h mov r0,a ajmp tm4 tm3:mov a,r1 add a,#10h mov r1,a tm4:reti ;0.5mS 延时子程序 delay:mov r6,#0f9h djnz r6,$ ret end