<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > AVR單片機與網(wǎng)絡(luò)的連接

          AVR單片機與網(wǎng)絡(luò)的連接

          作者: 時間:2016-11-30 來源:網(wǎng)絡(luò) 收藏
          本文介紹關(guān)于ARV單片機通過一塊芯片W5100上網(wǎng)模塊與網(wǎng)絡(luò)進行連接,一直以來對于嵌入式arduino怎么樣和網(wǎng)絡(luò)進行連接一直是我很好奇的問題,難得這幾天公司給我一個關(guān)于利用嵌入式讓AVR連接的應(yīng)用,雖然對于英語水平還是很低下的我,沒辦法,為了興趣和工作,只好硬著頭皮看著外國一些關(guān)于AVR與網(wǎng)絡(luò)連接的論壇。其中收獲還是蠻大的,讓自己知道了一些關(guān)于網(wǎng)絡(luò)的知識和電路,特別是自己把一塊ENC28J60上網(wǎng)模塊的PCB順利畫出來進行生產(chǎn),在畫這個板的時候也是費了一番功夫,根據(jù)原理圖,我覺得第12和第13引腳不應(yīng)該是短路的,可是當PCB板拿到手的時候進行硬件測試,居然發(fā)現(xiàn)這兩個引腳連在了一起。百思不得其解,把PCB板和畫的圖進行對比是沒有錯的,后來懷疑是IC的問題,但是經(jīng)過看數(shù)據(jù)手冊和IC不接在電路中的測試,沒有問題。最近對HR911105A網(wǎng)口進行測試,興奮地發(fā)現(xiàn)了問題是第3和第6是連在一起的。找出問題根源。




          一直對于arduino這種開發(fā)平臺和獨特的編程風格的感興趣。特別是他具有一個實時和電腦進行通訊的系統(tǒng)平臺,長話短說,還是把硬件進行連接,以及代碼的編寫和調(diào)試,因為ardunio官方指代了一個關(guān)于Ethernet的庫,所以把它下載下來,加以研究。終于寫出了下面的一段代碼:
          #include
          //Test Code:
          /*
          * Web Server
          *
          * A simple web server that shows the value of the analog input pins.
          */
          #include
          byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
          byte ip[] = { 192, 168, 0, 48 };
          Server server(80);
          void setup()
          {
          Ethernet.begin(mac, ip);
          server.begin();
          }
          void loop()
          {
          Client client =server.available();
          if (client) {
          // an http request ends with a blank line
          boolean current_line_is_blank = true;
          while (client.connected()) {
          if (client.available()) {
          char c = client.read();
          // if weve gotten to the end of the line (received a newline
          // character) and the line is blank, the http request has ended,
          // so we can send a reply
          if (c == n && current_line_is_blank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          上一頁 1 2 下一頁

          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();