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

正文內(nèi)容

單片機(jī)串口通信485modbus-資料下載頁

2025-06-26 12:22本頁面
  

【正文】 ^1。bit sflag。bit reflag1,reflag2,reflag3,reflag4,reflag5,reflag6,reflag7,reflag8。//接收標(biāo)志void fsdata()。void delay_50us (unsigned char _50us)。void Serial_int(void) interrupt 4 using 2 //串行中斷接收{(diào) ES=0。 RI=0。 dd=SBUF。 if(dd==0x32) { reflag6=1。 } ES=1。 } void fsdata() ES=0。 CON_485=1。 REN=0。 TI=0。 for(n=30。n0。n)。 SBUF=0x46。 //發(fā)送ACK 0x06 while(TI==0)。 TI=0。 for(n=30。n0。n)。 SBUF=0x32。 //發(fā)送ACK 0x06 while(TI==0)。 TI=0。 for(n=30。n0。n)。 SBUF=0x32。 //發(fā)送ACK 0x06 while(TI==0)。 TI=0。 for(n=30。n0。n)。 SBUF=displaybuf[0x01]amp。0x0f|0x30。 //發(fā)送ACK 0x06 while(TI==0)。 TI=0。 for(n=30。n0。n)。 SBUF=displaybuf[0x00]amp。0x0f|0x30。 //發(fā)送ACK 0x06 while(TI==0)。 TI=0。 for(n=30。n0。n)。 SBUF=0x46。 //發(fā)送ACK 0x06 while(TI==0)。 TI=0。 for(n=30。n0。n)。 SBUF=0x44。 //發(fā)送ACK 0x06 while(TI==0)。 CON_485=0。 REN=1。 ES=1。 }bit resetpulse(void){ unsigned char i。 DQ=0。 for(i=255。i0。i)。 DQ=1。 for(i=60。i0。i)。 return(DQ)。 for(i=200。i0。i)。}void writemandtods18b20(unsigned char mand){ unsigned char i。 unsigned char j。 for(i=0。i8。i++) { if((mand amp。 0x01)==0) { DQ=0。 for(j=35。j0。j)。 DQ=1。 } else { DQ=0。 for(j=2。j0。j)。 DQ=1。 for(j=33。j0。j)。 } mand=_cror_(mand,1)。 }}unsigned char readdatafromds18b20(void){ unsigned char i。 unsigned char j。 unsigned char temp。 temp=0。 for(i=0。i8。i++) { temp=_cror_(temp,1)。 DQ=0。 _nop_()。 _nop_()。 DQ=1。 for(j=10。j0。j)。 if(DQ==1) { temp=temp | 0x80。 } else { temp=temp|0x00。 } for(j=200。j0。j)。 } return(temp)。}void main(void){ TMOD=0x21。 TH0=(655362000)/256。 TL0=(655362000)%256。 PCON = 0x00。 SCON = 0x50。 // Mode 1, 8bit UART, enable receiption IP=0x10。 TH1=0xfd。 TL1=0xfd。 CON_485=0。 ES = 1。 ET1 = 0。 TR1 = 1。 ET0=1。 EA=1。 while(resetpulse())。 writemandtods18b20(0xcc)。 writemandtods18b20(0x44)。 TR0=1。 while(1) { if(reflag6==1) { reflag6=0。 fsdata()。 } }}void t0(void) interrupt 1 using 0{ unsigned char x。 unsigned int result。 TH0=(655362000)/256。 TL0=(655362000)%256。 if(displaycount==0) { P0=displaycode[displaybuf[displaycount]] amp。 0x7f。 } else { P0=displaycode[displaybuf[displaycount]]。 } P2=aa。 aa=(aa1)|0x01。 displaycount++。 if(displaycount==8) { displaycount=0。 aa=0xfe。 } timecount++。 if(timecount==150) { timecount=0。 while(resetpulse())。 writemandtods18b20(0xcc)。 writemandtods18b20(0xbe)。 readdata[0]=readdatafromds18b20()。 readdata[1]=readdatafromds18b20()。 for(x=0。x8。x++) { displaybuf[x]=16。 } sflag=0。 if((readdata[1] amp。 0xf8)!=0x00) { sflag=1。 readdata[1]=~readdata[1]。 readdata[0]=~readdata[0]。 result=readdata[0]+1。 readdata[0]=result。 if(result255) { readdata[1]++。 } } readdata[1]=readdata[1]4。 readdata[1]=readdata[1] amp。 0x70。 x=readdata[0]。 x=x4。 x=x amp。 0x0f。 readdata[1]=readdata[1] | x。//溫度值 x=0。 result=readdata[1]。 while(result/10) { displaybuf[x]=result%10。 result=result/10。 x++。 } displaybuf[x]=result。 x=readdata[0] amp。 0x0f。 x=x1。 displaybuf[2]=13。 if(sflag==1) { displaybuf[3]=10。 } else displaybuf[3]=13。 displaybuf[4]=12。 displaybuf[5]=11。 displaybuf[6]=(dotcode[x])%10。 displaybuf[7]=(dotcode[x])/10。 while(resetpulse())。 writemandtods18b20(0xcc)。 writemandtods18b20(0x44)。 }}參考文獻(xiàn): 1.Modbus通信協(xié)議 中約網(wǎng)國電力規(guī) 2.范逸之,陳立元,孫德萱,程正孚編,《利用Visual Basic實現(xiàn)串并行通信技術(shù)》,北京:清華大學(xué)出版社,28 /
點(diǎn)擊復(fù)制文檔內(nèi)容
外語相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1