1 / 25

The Firefly, WinAVR, and Programming in C

The Firefly, WinAVR, and Programming in C. Botrics Firefly Overview. Atmel AVR ATmega168 Microcontroller. The brains of your robot. Runs at 8MHz. 16Kb Flash ROM 1Kb SRAM Uses five volts regulated power (the battery puts out around six). Motor Control.

vance
Télécharger la présentation

The Firefly, WinAVR, and Programming in C

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Firefly, WinAVR, and Programming in C

  2. Botrics Firefly Overview

  3. Atmel AVR ATmega168 Microcontroller • The brains of your robot. • Runs at 8MHz. • 16Kb Flash ROM • 1Kb SRAM • Uses five volts regulated power (the battery puts out around six)

  4. Motor Control The L293 H-Bridge takes input from the microcontroller about how fast and in what direction to run the motors and then puts out enough current to do so. The motors are run directly from the battery voltage. The outputs of the H-Bridge are pinned out here.

  5. Serial Communications The serial port connector, a female DB9. The MAX232 buffer driver chip converts the TTL logic level serial communications on the microcontroller (5V/0V) to standard RS-232 logic levels (0V/-12V). Basically, all you need to know is that this is how your computer talks to the robot.

  6. Analog Input The microcontroller has eight analog input ports, labeled C0-C7. The Firefly allows easy access to C0-C5. Each port samples the voltage presented at it between 0 and 5 volts and translates this to a number between 0 and 255. Readings below 0 volts read 0; readings above 5 volts read 255. The potentiometer is attached to port C6. Rotating the dial reduces the voltage on C6 in one direction and increases it in another.

  7. Digital Input/Output The buttons are convenient digital inputs, reading 0 if not pressed or 1 if depressed. The analog ports are also capable of digital input and output.

  8. Other Output The power LED is a small red light which indicates whether or not the Firefly is receiving power. It does not tell you if it is receiving enough, however. The piezo buzzer can output tones of varying frequencies. The orb is three LEDs (red, green, and blue) in one package surrounded by a diffuser. It can output around sixteen million colors. The user LED is a small green light useful for displaying one bit of information.

  9. Other Important Things Power switch. Battery connector. Fuse. If this blows, your robot will mysteriously stop working. Five volt regulator – keeps the processor happy by keeping the voltage constant. In-System Programming Header – for initially programming the ATmega168.

  10. WinAVR • WinAVR (pronounced "whenever") is a suite of executable, open source software development tools for the Atmel AVR series of RISC microprocessors hosted on the Windows platform. It includes the GNU GCC compiler for C and C++. • http://winavr.sourceforge.net/

  11. WinAVR • GNU Binutils 2.15 • GNU GCC 3.4.3 • avr-libc 1.2.3 • avrdude 4.4.0 cvs (native Win32 app) • uisp 20050207 • avrdude-gui 0.2.0 • GNU Debugger (GDB) 6.1 • Insight 6.1 • avarice 2.3 • simulavr 0.1.2.1 • SRecord 1.21 • MFile • Programmers Notepad 2.0.5.32 • Many native Win32 GNU programs and utilities including make and bash. • Documentation in many formats for the various projects. • Makefile Template that you can copy and modify for your projects.

  12. WinAVR • GNU Binutils 2.15 • GNU GCC 3.4.3 • avr-libc 1.2.3 • avrdude 4.4.0 cvs (native Win32 app) • uisp 20050207 • avrdude-gui 0.2.0 • GNU Debugger (GDB) 6.1 • Insight 6.1 • avarice 2.3 • simulavr 0.1.2.1 • SRecord 1.21 • MFile • Programmers Notepad 2.0.5.32 • Many native Win32 GNU programs and utilities including make and bash. • Documentation in many formats for the various projects. • Makefile Template that you can copy and modify for your projects.

  13. WinAVR The Gnu Compiler Collection is a set of open source compilers (including C and C++) which are essentially free (GPLed). They are of a high quality and conform to ANSI standards. Compiling produces machine code in a HEX file that the AVR ATmega168 can understand. AVR Libc is a high quality C library for use with GCC on Atmel AVR microcontrollers. The AVRDownloader and Uploader is just that – a program that interfaces between the Firefly and the host computer to program and read the ATmega168.

  14. Programmers Notepad

  15. Programmers Notepad • Programmers Notepad is the IDE we will use in FwR. • IDE stands for Integrated Development Environment. • Write your code • Compile your code • Download your code to the robot

  16. Programmers Notepad Menu bar File tabs Current file Output Status bar

  17. Programmers NotepadWriting Your Code File tabs Current file

  18. Programmers NotepadCompiling Your Code Click! Output

  19. Programmers NotepadProgramming Your Robot Click! Output

  20. The Workaround Some cluster PCs don’t let you click “make all” and “make program”

  21. The Workaround … so you’ll have to tell the computer to run the commands manually.

  22. The Workaround … so you’ll have to tell the computer to run the commands manually. Move to the folder with your code

  23. The Workaround … so you’ll have to tell the computer to run the commands manually. Tell the computer where to find WinAVR

  24. The Workaround … so you’ll have to tell the computer to run the commands manually. Compile your code

  25. The Workaround … so you’ll have to tell the computer to run the commands manually. Program your code onto the robot

More Related