下载

1下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 18B20温度传感器

18B20温度传感器.doc

18B20温度传感器

赵谦道
2017-09-05 0人阅读 举报 0 0 0 暂无简介

简介:本文档为《18B20温度传感器doc》,可适用于职业岗位领域

#include<regh>#include<intrinsh>#defineuintunsignedint#defineucharunsignedchar************DSB**********sbitDQ=P^uchartemph=,templ=uintt=floattt=voiddelayb(uintz)dsbÑÓÊ{while(z)}voidbreset(void)dsbÎ{ucharready=DQ=delayb()DQ=delayb()DQ=delayb()ready=DQdelayb()}*ucharbrbit(void)ÁdsbBit{uchariDQ=DQ=for(i=i<i)return(DQ)}voidbwbit(ucharbitval)ÐdsbBit{DQ=if(bitval==)DQ=delayb()DQ=}voidbwbyte(ucharval)ÐÈëdsbÒ×ÖÚ{uchari,tempfor(i=i<i){temp=val>>temp=tempxbwbit(temp)delayb()}}ucharbrbyte(void)ÁödsbÒ×ÖÚ{uchari,j,datej=date=for(i=i<i){if(brbit()){date=date(j<<i)}delayb()}return(date)}*ucharbrbyte(void)ÁDSBÒ×ÖÚ{uchari=uchardat=for(i=i<i){DQ=dat>>=DQ=if(DQ)dat|=xdelayb()}return(dat)}voidbwbyte(uchardat)ÐDSBÒ×ÖÚ{uchari=for(i=i<i){DQ=DQ=datxdelayb()DQ=dat>>=}}uintbgettemp(void)ñÈDSBÉÏÎÂÈ{breset()bwbyte(xcc)bwbyte(x)delayb()breset()bwbyte(xcc)bwbyte(xbe)templ=brbyte()temph=brbyte()t=tempht<<=t=t|templtt=t*t=tt*delayb()return(t)}*************LCD*************sbitbeer=P^#definePPucharcodetable={"µç×ÓÊÖÓ"}ucharcodetable={"Êäº"}ucharcodetable={"ÈÕÆÚº"}ucharcodetable={"ÎÂÈ"}sbitlcdrs=P^ÒåLCDÒýÅsbitlcdrw=P^sbitlcden=P^sbitlcdpsb=P^sbitlcdrst=P^voiddelay(uintz)ÑÓÊ{uintx,yfor(x=x>x)for(y=zy>y)}voidlcdwcom(ucharcom)ÐÃüÁî{lcdrs=lcdrw=lcden=P=comdelay()lcden=delay()lcden=}voidlcdwdata(uchardate)ÐÊýÝ{lcdrs=lcdrw=lcden=P=datedelay()lcden=delay()lcden=}voidlcdinit()ÒºõÊ{lcdrst=delay()lcdrst=delay()lcdpsb=P=xffkey=key=lcdwcom(x)lcdwcom(xc)lcdwcom(x)lcdwcom(x)}voidlcdpos(ucharx,uchary)ÑÔñÐÈëÎÖÃ{ucharposif(x==){x=x}elseif(x==){x=x}elseif(x==){x=x}elseif(x==){x=x}pos=xylcdwcom(pos)}voidclrscreen()ÇåÆÁ{lcdwcom(x)delay()lcdwcom(x)delay()lcdwcom(x)}voiddispchinese(ucharcode*s){while(*s>){lcdwdata(*s)sdelay()}}voiddisptemp(){uinti=uchara=,b=,c=*uintshi,ge,xiaoshuuchara=,b=,c=lcdpos(,)i=bgettemp()shi=ige=ixiaoshu=ilcdpos(,)lcdwdata(wendushi)lcdwdata(wenduge)lcdwdata(xe)lcdwdata(wenduxiaoshu)dispchinese("æ")*lcdpos(,)i=bgettemp()a=ilcdwdata(ax)b=ia*lcdwdata(bx)lcdwdata(xe)c=ia*b*lcdwdata(cx)dispchinese("æ")}voidmain(){lcdinit()while(){disptitle()disptemp()}}

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

评分:

/10

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利