|
THS
|
Robots /
Notes102307Using WinAVR to Program the CreateThe goal for this session is to: • Show you how to install WinAVR (pronounced "whenever") on your home computer. WinAVR is the program that you will use to write and compile your programs in the C programming language to control the Create.
• Show you how to write your first program "Hello World" and the resources available to help you.
• Show you how to compile your program (and check for syntax errors).
• Show you how to download the executable file to your Create and run the program.
Our apologies to the Blue Cohort -- we had problems with the WinAVR installation that really slowed us down on Tuesday. Greg and I went through all the computers to correct the problems. I'm setting aside some extra time on Monday to get you up to speed!! This guide will step you through the outline below:
1. Installing WinAVR on your home computer •Please use the WinAVR Installation Guide (pdf) (class handout)
2. Decide what you want the Create to do—Plan Ahead! • Draw a flowchart or write an Algorithm! For most tasks you should draft a flowchart (rough pencil drawing) to guide you as you write your code.
• As you develop and test your code, you can update your flowchart, then finalize a copy to submit with your lab report/project.
• “Hello World” is a very simple program, so no flowchart is necessary.
3. Create a new project in WinAVR Programmer’s Notepad (Guide, pages 3 - 7) 4. Write your code (C program) in WinAVR Programmer’s Notepad (Guide, page 8 - 11) • Here's a handy Create API Data Structure & Function Reference Sheets (pdf)
5. “Compile” your code (Tools, Make All) in WinAVR Programmer’s Notepad (Guide, page 12) 5a. Debug – Go back to step 4 to correct syntax errors!
6. Download the “object code” to the Create (Guide, page 12) 7. Run the program on the Create (Finally!!) (Guide, page 12) 7a. Debug – Go back to step 4 to correct logic errors!
8. Done! |