Getting Started

(lily) #1

  • Chapter 1: Introduction

    • Why C?..............................................................................................................

    • Why AVR?.........................................................................................................

    • Goals



  • Chapter 2: Quick Start Guide

    • Software

      • WinAVR – Oh, Whenever...

      • Programmers Notepad...................................................................................

      • AVRStudio – FREE and darn well worth it.

      • Br@y++ Terminal:



    • Hardware

      • Constructing Your Development Platform



    • Blinking LEDs – Your First C Program

      • Write it in Programmers Notepad

      • Download to the Butterfly with AVRStudio..................................................

      • Blinky Goes Live

      • Simulation with AVRStudio



    • GOOD GRIEF!



  • Chapter 3: A Brief Introduction to C – What Makes Blinky Blink?

    • Comments

    • Include Files

    • Expressions, Statements, and Blocks

    • Operators

    • Flow Control

    • Functions

    • The Main() Thing



  • Chapter 4: C Types, Operators, and Expressions

    • Data Types and Sizes.....................................................................................

    • Variable Names

    • Constants

    • Declarations...................................................................................................

    • Arithmetic Operators.....................................................................................

    • Relational and Logical Operators..................................................................

    • Bitwise Operators

    • Assignment Operators and Expressions

    • Conditional Expressions................................................................................

    • Precedence and Order of Evaluation.............................................................

    • Projects..........................................................................................................

      • Port Input and Output................................................................................

      • Cylon Eye Speed and Polarity Control





  • Chapter 5: C Control Flow....................................................................................

    • Statements and Blocks

    • If-Else and Else-If

    • Switch............................................................................................................

    • Loops – While, For and Do-while.................................................................

    • Break and Continue.......................................................................................

    • Goto and Labels

    • A few practical examples: strlen, atoi, itoa, reverse......................................



  • Chapter 6: C Functions and Program Structures...................................................

    • Function Basics

    • Returns

    • Variables External, Static, and Register

    • Scope

    • Headers..........................................................................................................

    • Blocks............................................................................................................

    • Initialization

    • Recursion

    • Preprocessor

    • Projects..........................................................................................................

      • Is anybody out there? Communicating with a PC.....................................





  • Chapter 7: Microcontroller Interrupts and Timers

    • Interrupts

      • Projects........................................................................................................

        • Grab your joystick – and test your interrupts..........................................





    • Timers/Counters

    • Calibrating the Butterfly oscillator:

      • Projects........................................................................................................

        • Precision Blinking...................................................................................

        • Pulse Width Modulation – LED Brightness Control

        • Pulse Width Modulation - Motor Speed Control

        • Speedometer............................................................................................







  • Chapter 8: C Pointers and Arrays........................................................................

    • Addresses of variables

    • Function Arguments

    • Arrays

    • FIFOs and LIFOs: Stacks and Queues (Circular Buffers)

    • Function Pointers.........................................................................................

    • Complex Pointer and Array Algorithms......................................................

    • Projects

      • Messenger................................................................................................

      • Does anybody know what time it is? A Real Time Clock.

      • Music to my ears. “Play it again Sam.”...................................................





  • Chapter 9 – Digital Meets Analog – ADC and DAC

    • But First - A Debugging Tale

    • Analog to Digital Conversion

    • Projects

      • DAC and ADC - Function Generator / Digital Oscilloscope





  • Chapter 10: C Structures

    • Structure Basics...........................................................................................

    • Structures and Functions

    • Structure Arrays...........................................................................................

    • Typedef........................................................................................................

    • Unions

    • Bit-fields......................................................................................................

    • Projects

      • Finite State Machine................................................................................





  • Chapter 11 The Butterfly LCD............................................................................

    • PC to LCD test program..............................................................................

    • Conclusion...................................................................................................



  • Appendix 1: Project Kits

  • Appendix 2: Soldering Tutorial...........................................................................

  • Appendix 3: Debugging Tale

  • Appendix 4: ASCII Table

  • Appendix 5: Decimal, Hexadecimal, and Binary................................................

  • Appendix 6: Motor Speed Control Wheel...........................................................

  • Appendix 7: HyperTerminal................................................................................

  • Index....................................................................................................................

    • operating system at Bell Labs on a PDP-11.................................................. Ken Thompson, original inventor of Unix, designing the original Unix



  • Figure 2: The Butterfly front.................................................................................

  • Figure 3: RS-232 connections...............................................................................

  • Figure 4: Battery holder, switch, and batteries.

  • Figure 5: External battery connection to Butterfly

  • Figure 6: Butterfly hooked up to RS-232..............................................................

  • Figure 7: Bray's Terminal......................................................................................

  • Figure 8: Enter name to send to the Butterfly

  • Figure 9: Blinky wiring diagram and photo of wired board

  • Figure 10: Hardware setup for Blinky...................................................................

  • Figure 11: From the cover of the Battlestar Galactica comic Red Cylon..............

  • Figure 12: from page 92 of the ATMega169 data book

  • Figure 13 ATMega169 Block Diagram

  • Figure 14: Port I/O switch input and LED output.................................................

  • Figure 15: Bit 7 high Figure 16: Bit 7 low.........................................

  • Figure 17: Pulse Width Modulation Duty Cycle.................................................

  • Figure 18: Motor Speed Control Schematic and Parts........................................

  • Figure 19: Motor Speed Control Breadboard Labeled........................................

  • Figure 20: Motor Speed Control Hardware

  • Figure 21: Motor Base

  • Figure 22: Motor Wheel Stationary and Spinning

  • Figure 23: Opto Interrupt Switch - H21A1

  • Figure 24: Opto Interrupter Glued on Motor Base

  • Figure 25: Speedometer

    • used a Teletype machine to write the C programming language. Figure 26: The PDP-11 could be programmed by switches, though Dennis Ritchie



  • Figure 27: 10-bit successive approximation ADC Figure...................................

  • Figure 28: Potentiometer Schematic

  • Figure 29: Voltage measurement.........................................................................

  • Figure 30: R-2R resistor ladder...........................................................................

  • Figure 31: Breadboard of R-2R DAC

  • Figure 32: Breadboard R-2R DAC wiring

  • Figure 33: R-2R DAC with Oscilloscope

  • Figure 34: Function Generator / Digital Oscilloscope on HyperTerminal..........

  • Figure 35: Sine Wave Figure 36: Square Wave..............................................

  • Figure 37: Triangle Wave Figure 38: Sawtooth Wave

  • Figure 39 Butterfly Menu....................................................................................

  • Figure 40: Cheap soldering iron, solder and wick from JAMECO.....................

  • Figure 41: Seasoning the tip................................................................................

Free download pdf