#include
#define waterin P1_6
#define waterout P1_5
#define swim P1_7
bit flag;
char Count,t,waterinflag,wateroutflag,swimflag; // 用于中断程序的计数
unsigned char second;
void Timeinit(void)
{
//秒表初始化
Count=0; t=0; second=0; flag=0;
// 开定时器1,设定为工作方式2, 让定时中断时自动加载定时的初值
IE=0x8a; //允许中断,选中T0,T1中断
TMOD=0x21; //定时器0,使用TR0启动方式,选中工作方式1,定时器1,使用TR1启动方式,工作方式2
TH1=0x06; //设置定时初值 256-250=6 (250us,要实现10ms就要40次)
TL1=0x06;
TR1=1;
}
//用T1定时的秒表中断程序,工作方式2
void Miao(void) interrupt 3
{
Count++;
if(Count==40){
Count=0;
t++; //百分秒
if(t==100){