freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于單片機(jī)的超聲波測(cè)距儀的設(shè)計(jì)參考論文-資料下載頁(yè)

2025-06-27 19:48本頁(yè)面
  

【正文】 set()。 //復(fù)位 delay(1)。 tmpwrite(0xcc)。 //跳過(guò)序列號(hào)命令 tmpwrite(0x44)。 //轉(zhuǎn)換命令}////////////////////////////////////////////////////////////void tmp(void) //溫度采集及轉(zhuǎn)換{ int m,n=0。 float temnum1=0。 dsreset()。 delay(1)。 tmpwrite(0xcc)。 tmpwrite(0xbe)。 temp_l=readbyte()。 //低位在前 temp_h=readbyte()。 //高位在后 flag1=temp_hamp。0xf8。 if(flag1) { n=flag1。 temp_h=~temp_h。 if(temp_l==0)temp_h++。 //若低8位全為0且溫度為負(fù),取補(bǔ)時(shí)就要向高位進(jìn)1 temp_l=~temp_l+1。 } temnum1=(temp_h*256+temp_l)/16。 if(temnum110) { tembuf[3]=11。 tembuf[2]=11。 tembuf[1]=(uchar)temnum1。 tembuf[0]=(uchar)(temnum1*10)%10。 } if(temnum1=100) { tembuf[3]=(uchar)temnum1/100。 m=(int)temnum1%100。 tembuf[2]=(uchar)m/10。 tembuf[1]=(uchar)m%10。 tembuf[0]=(uchar)(temnum1*10)%10。 } if(temnum1100amp。amp。temnum1=10) { tembuf[3]=11。 tembuf[2]=(uchar)temnum1/10。 tembuf[1]=(uchar)temnum1%10。 tembuf[0]=(uchar)(temnum1*10)%10。 } if(n==0xf8)tembuf[3]=10。 temnum=temnum1。 }////////////////////////////////////////////////////////// void dis(void) //溫度顯示{ uchar i。 uchar j=0xfe。 for(i=0。i4。i++) //輸送顯示數(shù)據(jù) { P0=0xff。 P0=ledcode[tembuf[i]]。 if(i==1)P0=ledcode[tembuf[i]]+0x80。 //小數(shù)點(diǎn)顯示 P2=j。 delay(15)。 j=(j1)+0x01。 }}///////////////////////////////////////////////////////void distance(void) //計(jì)算測(cè)量得到的距離{ double radical,dist。 if(b!=0) { radical=sqrt(1+(temnum+273)/273)。 dist=*t*radical。 dist=dist+。 //四舍五入并留兩位小數(shù) if(dist0amp。amp。dist10) { dispbuf[3]=11。 dispbuf[2]=(uchar)dist。 dispbuf[1]=(uchar)(dist*10)%10。 dispbuf[0]=(uchar)(dist*100)%10。 } if(dist=10amp。amp。dist=0) //測(cè)量距離大于10米或小于0顯示,也有出錯(cuò)的意思 { dispbuf[3]=10。 dispbuf[2]=10。 dispbuf[1]=10。 dispbuf[0]=10。 } if(dist100amp。amp。dist=10) { dispbuf[3]=(uchar)dist/10。 dispbuf[2]=(uchar)dist%10。 dispbuf[1]=(uchar)(dist*10)%10。 dispbuf[0]=(uchar)(dist*100)%10。 } } else { //當(dāng)T1溢出時(shí),則測(cè)量時(shí)間無(wú)效 dispbuf[3]=10。 dispbuf[2]=10。 dispbuf[1]=10。 dispbuf[0]=10。 }} ///////////////////////////////////////////////////////void dis1(void) //距離顯示{ uchar i。 uchar j=0xfe。 for(i=0。i0。i++) /*輸送顯示數(shù)據(jù)*/ { P0=0xff。 P0=ledcode[dispbuf[i]]。 if(i==2)P0=ledcode[dispbuf[i]]+0x80。 //小數(shù)點(diǎn)顯示 P2=j。 delay10ms(1)。 j=(j1)+0x01。 }}///////////////////////////////////////////////////////////////void dis2(void) { uchar i。 uchar j=0xfe。 dispbuf[3]=11。 dispbuf[2]=11。 dispbuf[1]=11。 dispbuf[0]=0。 for(i=0。i4。i++) /*輸送顯示數(shù)據(jù)*/ { P0=0xff。 P0=ledcode[dispbuf[i]]。 P2=j。 delay10ms(1)。 j=(j1)+0x01。 }}///////////////////////////////////////////////////////////////void timer1(void)interrupt 3 { TR1=0。 TH1=0x00。 TL1=0x00。}///////////////////////////////////////////////////////////////void timer0(void)interrupt 1 { send=!send。 TH0=0x1f。 TL0=0xf4。}///////////////////////////////////////////////////////void int1(void)interrupt 2 { if(TH1!=0x00amp。amp。TH0!=0x00) { b=1。 TR1=0。 TR0=0。 t=TH1*256+TL1。 t=t/1000000。 TH0=0x1f。 TL0=0xf4。 TH1=0x00。 TL1=0x00。 } else { b=0。 TR1=0。 TR0=0。 TH0=0x1f。 TL0=0xf4。 TH1=0x00。 TL1=0x00。 }}///////////////////////////////////////////////////////main(){ unint i。 EA=1。 //開(kāi)中斷 TMOD=0x10。 //設(shè)定時(shí)器0、定時(shí)器1都工作在定時(shí)狀態(tài),T0方式0,T1方式1 ET0=1。 //定時(shí)器0中斷允許 ET1=1。 //定時(shí)器1中斷允許 IT1=0。 //外部中斷1低電平有效 TH0=0x1f。 TL0=0xf4。 TH1=0x00。 TL1=0x00。 send=1。 receive=1。 k1=1。 k2=1。//////////////////////////////////////////////////////////////// while(1) { dis2()。 if(k1!=1) //判斷k1是否按下,按下則開(kāi)始執(zhí)行溫度轉(zhuǎn)換和測(cè)距操作 { delay(100)。 //消抖 if(k1!=1) { tmpchange()。 //啟動(dòng)溫度轉(zhuǎn)換 tmp()。 EX1=1。 //外部中斷1中斷允許 TR0=1。 //T0定時(shí)開(kāi)始 TR1=1。 //T1定時(shí)開(kāi)始 delay10ms(7)。 distance()。 EX1=0。 while(1) { dis1()。 if(k2!=1) { delay(100)。 if(k2!=1) { for(i=0。i200。i++) { tmpchange()。 tmp()。 dis()。 } } } if(k3!=1) { delay(100)。 if(k3!=1) break。 } } } } } }///////////////////////////////////////////////// 附錄3 外文復(fù)印件Ultrasonic wave production: The sound wave is the object mechanical vibrations condition (or energy) dissemination form. The socalled vibration is refers to material the particle the reciprocating motion which carries on nearby its position of equilibrium. For example, drum surface after rap, it on high and low vibrates, this kind of vibrational state to disseminates in all directions through the air medium, this is a sound wave. The ultrasonic wave is refers to the vibrational frequency to be bigger than above 20KHz, its each second vibration number of times (frequency) very high, has surpassed the person ear sense of hearing upper limit (20000Hz), people sound wave named ultrasonic wave which cannot hear this kind. Supersonic and may Wen Sheng be essentially consistent, their mon ground is one kind of mechanical vibrations, usually will disseminate by the longitudinal wave way in the elastic medium, will be one kind of energy dissemination form, its
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1