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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > STM32單片機學(xué)習(xí)(7) 串口通信printf重定向

          STM32單片機學(xué)習(xí)(7) 串口通信printf重定向

          作者: 時間:2016-11-19 來源:網(wǎng)絡(luò) 收藏
          此處是為了在串口中斷通信[參見另一篇文章]中添加printf重定向功能

          1、添加頭文件#include

          本文引用地址:http://www.ex-cimer.com/article/201611/318201.htm

          2、工程“Target" -->勾選 "Use MicroLIB"

          3、重定義fputc函數(shù)

          int fputc(int ch, FILE *f){Uart1_PutChar((u8)ch);  //此處為自定義函數(shù),參見串口中斷通信,請勿盲目return (ch);}

          經(jīng)過上述配置后即可在項目中使用printf("Hello~");等來發(fā)送字符串了

          (printf("<格式化字符串>", <參量表>) 與C語言使用一樣)



          評論


          技術(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); })();