Presentation is loading. Please wait.

Presentation is loading. Please wait.

Using the AVR UART Demo. Overview  How do I know what to do?  What do I do?  Setup the Wunderboard  Setup the Host computer  Setup the #define statements.

Similar presentations


Presentation on theme: "Using the AVR UART Demo. Overview  How do I know what to do?  What do I do?  Setup the Wunderboard  Setup the Host computer  Setup the #define statements."— Presentation transcript:

1 Using the AVR UART Demo

2 Overview  How do I know what to do?  What do I do?  Setup the Wunderboard  Setup the Host computer  Setup the #define statements

3 How do I know what to do?  The first step is to read even if it does not make sense the first time  Second is to ask  Third is to hope and pray ;)

4 What do I do?  When working with lots of 'unknowns' limit yourself to one unknown at a time.  Don't try new software on a PC and a microcontroller while also using new hardware.  Limit your uncertainty

5 Setup the Wunderboard  The Wunderboard code needs three functions  unsigned char InitializeUART ()  unsigned char SendByteUART ()  unsigned char SendStringUART()

6 unsigned char InitializeUART ()  This function setup the Wunderboard to transmit serial data  You need to set the values of the UBRRn, UCSRnA, UCSRnB, and UCSRnC registers  Make sure you read the datasheet, section 18.10 thoroughly

7 unsigned char SendByteUART ()  This function should check if the UART is ready to send a new byte.  If it is, it should send other wise it should exit immediately  Don't forget your return value!

8 unsigned char SendStringUART()  This function should try to send a string of characters by repeatedly calling the SendByteUART() function  If the first character it tries to send fails, the function should exit immediately  Otherwise the function blocks until the entire string is sent.

9 Setup the Host computer  To see the serial data being sent from the Wunderboard, you need to setup a 'terminal' program  Make sure you use the same settings as your Wunderboard

10 Setup the #define statements  Finally once you know your code works, encase the UART material in #ifdef preprocessor statements  This lets you enable and disable the UART with a single line.

11 Parting Thoughts  Look at return values and write functions that use them  Read everything  Ask for help


Download ppt "Using the AVR UART Demo. Overview  How do I know what to do?  What do I do?  Setup the Wunderboard  Setup the Host computer  Setup the #define statements."

Similar presentations


Ads by Google