基于51单片机的温度测试系统有vb上位机内容摘要:

if(h2==4amp。 amp。 h1==2) { h2=0。 h1=0。 } write_(0x80+0x40+0x01)。 write_date(table2[h1])。 write_date(table2[h2])。 write_ds(0x84,h1*16+h2)。 //向 ds1302中写入时 } } else if(temp==0x0b) { delay(5)。 if(temp==0x0b) { while(temp==0x0b)//松手检测 { temp=P2。 tempamp。 =0x0f。 } h=read_ds(0x85)。 h1=h/16。 h2=h%16。 h2=1。 if(h2==1) { h2=9。 h1=1。 } if(h2==9amp。 amp。 h1==1) { h2=3。 h1=2。 } write_(0x80+0x40+0x01)。 write_date(table2[h1])。 write_date(table2[h2])。 write_ds(0x84,h1*16+h2)。 } } } if(num1==4) { write_(0x80+0x0f)。 write_(0x0f)。 temp=P2。 tempamp。 =0x0f。 if(temp==0x0d) { delay(5)。 if(temp==0x0d) { while(temp==0x0d)//松手检测 { temp=P2。 tempamp。 =0x0f。 } day=read_ds(0x8b)。 //从 ds1302中读星期 day+=1。 if(day==8) { day=1。 } write_(0x80+0x0f)。 write_date(table2[day])。 write_ds(0x8a,day)。 //向 ds1302中写入星期 } } else if(temp==0x0b) { delay(5)。 if(temp==0x0b) { while(temp==0x0b)//松手检测 { temp=P2。 tempamp。 =0x0f。 } day=read_ds(0x8b)。 day=1。 if(day==0) { day=7。 } write_(0x80+0x0f)。 write_date(table2[day])。 write_ds(0x8a,day)。 } } } if(num1==5) { write_(0x80+0x09)。 write_(0x0f)。 temp=P2。 tempamp。 =0x0f。 if(temp==0x0d) { delay(5)。 if(temp==0x0d) { while(temp==0x0d)//松手检测 { temp=P2。 tempamp。 =0x0f。 } date=read_ds(0x87)。 //从 ds1302中读日期 date1=date/16。 date2=date%16。 date2+=1。 if(date2==10) { date2=0。 date1+=1。 } if(date2==2amp。 amp。 date1==3) { date2=0。 date1=0。 } if(date1==0amp。 amp。 date2==0) { date1=0。 date2=1。 } write_(0x80+0x08)。 write_date(table2[date1])。 write_date(table2[date2])。 write_ds(0x86,date1*16+date2)。 //向 ds1302中写入日期 } } else if(temp==0x0b) { delay(5)。 if(temp==0x0b) { while(temp==0x0b)//松手检测 { temp=P2。 tempamp。 =0x0f。 } date=read_ds(0x87)。 date1=date/16。 date2=date%16。 date2=1。 if(date2==1) { date2=9。 date1=1。 } if(date2==9amp。 amp。 date1==1) { date2=1。 date1=3。 } if(date1==0amp。 amp。 date2==0) { date1=3。 date2=1。 } write_(0x80+0x08)。 write_date(table2[date1])。 write_date(table2[date2])。 write_ds(0x86,date1*16+date2)。 } } } if(num1==6) { write_(0x80+0x06)。 write_(0x0f)。 temp=P2。 tempamp。 =0x0f。 if(temp==0x0d) { delay(5)。 if(temp==0x0d) { while(temp==0x0d)//松手检测 { temp=P2。 tempamp。 =0x0f。 } mon=read_ds(0x89)。 //从 ds1302中读月 mon1=mon/16。 mon2=mon%16。 mon2+=1。 if(mon2==10) { mon2=0。 mon1+=1。 } if(mon2==3amp。 amp。 mon1==1) { mon2=0。 mon1=0。 } if(mon1==0amp。 amp。 mon2==0) { mon1=0。 mon2=1。 } write_(0x80+0x05)。 write_date(table2[mon1])。 write_date(table2[mon2])。 write_ds(0x88,mon1*16+mon2)。 //向 ds1302中写入月 } } else if(temp==0x0b) { delay(5)。 if(temp==0x0b) { while(temp==0x0b)//松手检测 { temp=P2。 tempamp。 =0x0f。 } mon=read_ds(0x89)。 mon1=mon/16。 mon2=mon%16。 mon2=1。 if(mon2==1) { mon2=9。 mon1=1。 } if(mon2==9amp。 amp。 mon1==1) { mon2=2。 mon1=1。 } if(mon1==0amp。 amp。 mon2==0) { mon1=1。 mon2=2。 } write_(0x80+0x05)。 write_date(table2[mon1])。 write_date(table2[mon2])。 write_ds(0x88,mon1*16+mon2)。 } } } if(num1==7) { write_(0x80+0x03)。 write_(0x0f)。 temp=P2。 tempamp。 =0x0f。 if(temp==0x0d) { delay(5)。 if(temp==0x0d) { while(temp==0x0d)//松手检测 { temp=P2。 tempamp。 =0x0f。 } year=read_ds(0x8d)。 //从 ds1302中读年 year1=year/16。 year2=year%16。 year2+=1。 if(year2==10) { year2=0。 year1+=1。 } if(year1==9) { year1=0。 } write_(0x80+0x02)。 write_date(table2[year1])。 write_date(table2[year2])。 write_ds(0x8c,year1。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。