用Arduino板學AVR篇程 - USART

Submitted by saladlam on

控制serial port是MCU篇程一個很基本的技巧。而ATmega328P的說明書都寫得幾清楚背後的原理是怎麼樣,但對一個新手來說,由零開始寫始終是一大挑戰。

Peter Fleury寫了一個控制USART的Library,但Code實在太舊。Tim Sharpe修改了由他所寫的Library,令到Library可以用於新出的MCU,並支持現今的AVR-GCC Complier。

我用了這個Library,並作出少許修改,試作serial port通訊。試驗如下:

23092011-0001.jpg
顯示出預定的句字

23092011-0002.jpg
在Keyboard亂打一通,都識feedback,証明程式正常運作

Add new comment

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
Enter the characters shown in the image.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.