<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>
關(guān) 閉

新聞中心

EEPW首頁(yè) > 工控自動(dòng)化 > 設計應用 > MD600G的Internet無(wú)線(xiàn)傳感器網(wǎng)絡(luò )設計

MD600G的Internet無(wú)線(xiàn)傳感器網(wǎng)絡(luò )設計

作者: 時(shí)間:2010-11-25 來(lái)源:網(wǎng)絡(luò ) 收藏

1.3 溫度節點(diǎn)

  溫度節點(diǎn)模塊主要由溫度DS18B20組成,并將其輸出的溫度數據送往單片機,然后單片機將這些數據進(jìn)行相關(guān)處理,最后再送往后續的通信設備,并將溫度數據進(jìn)行數碼管或液晶屏顯示。這里采用了實(shí)時(shí)時(shí)鐘電路DS1302來(lái)實(shí)現該系統的實(shí)時(shí)性。

2 軟件設計

  基于MD600G和Internet的網(wǎng)的軟件包括溫度傳感器節點(diǎn)的軟件設計、MD600G與溫度傳感器節點(diǎn)的串口軟件設計、服務(wù)器mSever端與Internet網(wǎng)的數據通信軟件及mSever端溫度數據可視化程序的設計等。

2.1 mSever端溫度數據可視化程序設計

  利用Visual C++強大的編譯器以及與數據庫的處理能力,開(kāi)發(fā)出基于Windows平臺的32位數據可視化應用程序。圖3是mSever端溫度數據可視化程序設計的原理圖。

按此在新窗口瀏覽圖片
圖3 可視化界面的設計原理圖

  以下為可視化界面模塊源碼:

void CDemoView::OnInitialUpdate() {
  CView::OnInitialUpdate();
  CRect Rect;
  GetClientRect(Rect);
  m_Plot.Create(WS_CHILD|WS_VISIBLE,Rect,this,12000);
  m_Plot.SetSerie(0, PS_SOLID, RGB(255,0,0), 0.0, 40.0, Temperature);//窗口
  m_Plot.SetLegend(0, PS_SOLID, RGB(255,0,0), Temperature);//背景方框
  m_Plot.m_bAutoScrollX=TRUE;
  SetTimer(1,1000,NULL);//背景刷新時(shí)間
  canSize=TRUE;
}
void CDemoView::OnTimer(UINT nIDEvent) {
  static BOOL pros={FALSE};
  if(!pros) {
    pros=TRUE;
    CDemoDoc* pDoc=GetDocument();
    ASSERT_VALID(pDoc);
    y=pDoc->p.buffer;
    m_Plot.AddPoint(0,CTime::GetCurrentTime(),y);
    Invalidate();
    pros=FALSE;
  }
  CView::OnTimer(nIDEvent);
}
void CDemoView::OnSize(UINT nType, int cx, int cy) {
  CView::OnSize(nType, cx, cy);
  if(canSize) {
    CRect Rect;
    GetClientRect(Rect);
    m_Plot.MoveWindow(Rect);
  }
}
void CDASocket::OnReceive(int nErrorCode) { //接收數據端的程序
  char buff[64];
  int ret=0;
  ret=Receive(buff,64);//AfxMessageBox(OK);
  if(ret==ERROR)
  {TRACE(ERROR!);}
  else
  m_pDoc->Presscessding(buff);
  CAsyncSocket::OnReceive(nErrorCode);
}

  圖4是用Visual C++開(kāi)發(fā)的mSever端溫度數據可視化顯示的界面,圖中顯示的是1個(gè)節點(diǎn)的溫度變化實(shí)時(shí)曲線(xiàn)。

按此在新窗口瀏覽圖片
圖4 服務(wù)器mSever端溫度數據可視化顯示界面

2.2 mSever端Web訪(fǎng)問(wèn)程序設計

  為了實(shí)現多個(gè)客戶(hù)端可以同時(shí)訪(fǎng)問(wèn)數據中心服務(wù)器,規定客戶(hù)端在打開(kāi)服務(wù)器的Web頁(yè)面時(shí),首先提交客戶(hù)端的IP地址,然后服務(wù)器端把客戶(hù)端的IP地址收錄入庫,再將接收到的溫度數據轉發(fā)給指定的客戶(hù)端。因此,當有多個(gè)客戶(hù)端同時(shí)訪(fǎng)問(wèn)數據中心服務(wù)器時(shí),服務(wù)器端只需要將各個(gè)客戶(hù)端的IP地址收錄入庫,最后再循環(huán)不斷地往各個(gè)客戶(hù)端轉發(fā)溫度數據即可。

  當客戶(hù)端斷開(kāi)與服務(wù)器端的連接時(shí),將向服務(wù)器提交斷開(kāi)請求,從服務(wù)器端的IP地址庫中釋放掉該客戶(hù)端的IP地址,從而實(shí)現了服務(wù)器端IP地址庫的動(dòng)態(tài)更新。



評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>