鱼缸智能控制系统的研究与设计 下载本文

内容发布更新时间 : 2024/11/14 23:11:30星期一 下面是文章的全部内容请认真阅读。

if(s3==0) { }

if(set_num==1){write_com(0x80+0x40+8);} if(set_num==3){write_com(0x80+0x40+2);} if(set_num==4){set_num=0;write_com(0x80+15);}

if(set_num!=0) {

if(s2==0) {

delay(5); if(s2==0) {

while(!s2);

delay(1);

if(s3==0)set_num++; while(!s3);

if(set_num==2){write_com(0x80+0x40+5);}

if(set_num==1){set_miao++;if(set_miao==60)set_miao=0;write_sfm(0x48,set_miao);wri

te_com(0x80+0x40+8);}

if(set_num==2){set_fen++;if(set_fen==60)set_fen=0;write_sfm(0x45,set_fen);write_com

(0x80+0x40+5);}

if(set_num==3){set_shi++;if(set_shi==24)set_shi=0;write_sfm(0x42,set_shi);write_com(

0x80+0x40+2);}

} {

52

}

}

}

if(s1num!=0&&s1num!=8)

if(s2==0) { delay(1); if(s2==0) { while(!s2); if(s1num==1) { miao++;

if(miao==60)miao=0;

write_sfm(0x48,miao);

write_com(0x80+0x40+8);

}

if(s1num==2) { fen++;

if(fen==60)fen=0;

write_sfm(0x45,fen); write_com(0x80+0x40+5);

}

if(s1num==3) { shi++; if(shi==24)shi=0; write_sfm(0x42,shi); write_com(0x80+0x40+2);

}

if(s1num==4) { xq++;

if(xq==8)xq=0;

write_sfm(12,xq);

53

write_com(0x80+12);

}

if(s1num==5) { re++;

if(re==31)re=0; write_sfm(9,re); write_com(0x80+9);

}

if(s1num==6) { yue++;

if(yue==13)yue=0; write_sfm(6,yue); write_com(0x80+6); }

if(s1num==7) { nian++;

if(nian==100)nian=0; write_sfm(3,nian); write_com(0x80+3); }

}

}

if(s3==0) { delay(1); if(s3==0) { while(!s3); if(s1num==1)

{

54

miao--;

if(miao==-1)miao=59; write_sfm(0x48,miao); write_com(0x80+0x40+8);

}

if(s1num==2) { fen--;

if(fen==-1)fen=59; write_sfm(0x45,fen); write_com(0x80+0x40+5);

}

if(s1num==3) { shi--;

if(shi==-1)shi=23; write_sfm(0x42,shi); write_com(0x80+0x40+2);

}

if(s1num==4) { xq--; if(xq==-1)xq=0;

write_sfm(12,xq); write_com(0x80+12);

}

if(s1num==5) { re--;

if(re==-1)re=0; write_sfm(9,re); write_com(0x80+9);

}

if(s1num==6)

55

{ yue--;

if(yue==-1)yue=0; write_sfm(6,yue); write_com(0x80+6);

}

if(s1num==7) { nian--;

if(nian==-1)nian=0; write_sfm(3,nian); write_com(0x80+3); }

}

}

}

}

void write_ds(uchar add,uchar date)// { dscs=0; dsas=1; dsds=1; dsrw=1; P0=add; dsas=0; dsrw=0; P0=date; dsrw=1; dsas=1; dscs=1;

}

uchar read_ds(uchar add) {

56