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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 89C52單片機串行通信編程兩則

          89C52單片機串行通信編程兩則

          作者: 時間:2013-04-07 來源:網(wǎng)絡 收藏

          1.當串行口按工作方式1進行串行數(shù)據(jù)通信時,假定波特率為1 200b/s,以中斷方式傳送數(shù)據(jù),請編寫全雙工通信程序。

          #include at89x52.h>

          unsigned char data txbuf;

          unsigned char data rebuf;

          void main()

          {

          unsigned char temp;

          SCON=0x50;

          TMOD=0x20;

          TH1=0xE8;

          TL1=0xE8;

          TR1=1;

          ES=1;

          EA=1;

          }

          void comre()

          {

          rebuf=SBUF;

          }

          void comtx()

          {

          SBUF=txbuf;

          }

          void serial_server() interrupt 4

          {

          if(TI)

          TI=0;

          else

          {

          RI=0;

          comre();

          }

          }

          2.當串行口按工作方式3進行串行數(shù)據(jù)通信時,假定波特率為1 200b/s,第9位數(shù)據(jù)作奇偶校驗位,以中斷方式傳送數(shù)據(jù),請編寫通信程序。

          #include at89x52.h>

          unsigned char data txbuf;

          unsigned char data rebuf;

          光電開關相關文章:光電開關原理

          上一頁 1 2 下一頁

          評論


          相關推薦

          技術專區(qū)

          關閉
          看屁屁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); })();