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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > STM32 printf 重定向

          STM32 printf 重定向

          作者: 時間:2016-11-17 來源:網(wǎng)絡 收藏
          只需一步:

          Options 選項里面Target選項頁 將Use MicroLIB 勾上。
          為了實現(xiàn)重定向 printf()函數(shù),我們需要重寫 fputc() 這個 c 標準庫函數(shù),
          因為 printf()在 c 標準庫函數(shù)中實質(zhì)是一個宏,最終是調(diào)用了 fputc()這個函數(shù)
          的。
          int fputc(int ch, FILE *f)
          {
          /* 將 Printf 內(nèi)容發(fā)往串口 */
          USART_SendData(USART1, (unsigned char) ch);
          while( USART_GetFlagStatus(USART1,USART_FLAG_TC)!= SET);
          return (ch);
          }



          關鍵詞: STM32printf重定

          評論


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