- •Chapter 1: Introduction
- •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!
- •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
- •Seen on a shirt at a Robothon event:
- •Bits
- •Bytes
- •The long and short of it
- •Variable Names
- •Constants
- •Declarations
- •Arithmetic Operators
- •Relational and Logical Operators
- •Bitwise Operators
- •Testing Bits
- •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
- •Macro Substitution
- •Conditional Inclusion
- •Projects
- •Is anybody out there? Communicating with a PC
- •Demonstrator
- •PC_Comm
- •Using CommDemo:
- •Chapter 7: Microcontroller Interrupts and Timers
- •Interrupts
- •Projects
- •Grab your joystick – and test your interrupts
- •Using joystick
- •Timers/Counters
- •Calibrating the Butterfly oscillator:
- •OSCCAL_calibration() function – detailed explanation
- •ALL THIS AND WE HAVEN’T EVEN STARTED CALIBRATING YET!
- •Projects
- •Precision Blinking
- •Using 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)
- •Stacks
- •Queues (Circular Buffers)
- •Function Pointers
- •Complex Pointer and Array Algorithms
- •Projects
- •Messenger
- •Arrays in RAM and ROM
- •Does anybody know what time it is? A Real Time Clock.
- •A one second interrupt
- •Converting Computer Time to Human Readable Time
- •The Real Timer Clock Software
- •Music to my ears. “Play it again Sam.”
- •More on pointers to arrays
- •Setting the frequency
- •Setting the duration
- •An example song array – Fur Elise
- •Using the Piezo-element to make sound
- •Initializing the Timer1 for PWM to the piezo-element.
- •Generating the tone using PWM from Timer1
- •Using the Timer0 interrupt to play a tune
- •Chapter 9 – Digital Meets Analog – ADC and DAC
- •But First - A Debugging Tale
- •Analog to Digital Conversion
- •What is Analog to Digital Conversion?
- •Analog to Digital Conversion by Successive Approximation
- •Analog to Digital Conversion with the ATMEGA169
- •Starting a Conversion
- •Conversion Timing
- •Changing Channels
- •Digital Noise Reduction
- •Conditioning the Analog Input Signal
- •Accuracy
- •Projects
- •Initializing the ADC
- •Reading the ADC
- •Light Meter
- •Temperature Meter
- •The @#%#&*#!!!! Volt Meter
- •Using ADC
- •DAC and ADC - Function Generator / Digital Oscilloscope
- •Chapter 10: C Structures
- •Structure Basics
- •Structures and Functions
- •Structure Arrays
- •Typedef
- •Unions
- •Bit-fields
- •Bit-Fields the C-way
- •Bit-fields the masking-way
- •Projects
- •Finite State Machine
- •Chapter 11 The Butterfly LCD
- •PC to LCD test program
- •Conclusion
- •Appendix 1: Project Kits
- •Data I/O
- •PWM Motor Control
- •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
Appendix 1: Project Kits
Appendix 1: Project Kits
Note: check the website: www.smileymicros.com to see if any of these items are available there for less (don’t forget to include shipping and handling in your calculations when figuring ‘less’).
Parts Lists (Prices for Spring 2005):
From Digi-Key:
Note: Digi-Key charges a $5 handling charge on all orders under $25. Since the AVR Butterfly is $19.99 they add the $5 charge, but if you buy $5.01 additional items, they drop the $5 handling charge, giving you $5 worth of stuff for a penny. So add $1.84 of extra parts to the order and get $5 free. I like free, don’t you?
Description |
|
Part Number |
|
Quan |
|
Price/Unit |
Total |
|
AVR Butterfly |
|
ATAVRBFLY-ND |
1 |
|
|
19.99 |
19.99 |
|
D-SUB 9 female solder cup |
|
209F-ND |
1 |
|
|
0.63 |
0.63 |
|
Female header single 2 pin |
|
S4002-ND |
1 |
|
|
0.21 |
0.21 |
|
Female header single 3 pin |
|
S4003-ND |
1 |
|
|
0.30 |
0.30 |
|
Female header single 4 pin |
|
S4004-ND |
1 |
|
|
0.39 |
0.39 |
|
Female header double 10 pin |
|
S4205-ND |
2 |
|
|
0.82 |
1.64 |
|
|
|
|
|
|
|
|
|
|
Subtotal |
|
|
|
|
|
|
|
23.16 |
|
|
|
|
|
|
|
|
|
MORE STUFF – see note |
|
Your choice - see note |
|
|
|
|
|
1.84 |
|
|
|
|
|
|
|
|
|
Total |
|
|
|
|
|
|
|
25.00 |
From JAMECO: |
|
|
|
Quan |
|
|
|
|
Description |
|
Part Number |
|
|
|
Price/Unit |
Total |
|
Breadboard |
|
20722CP |
1 |
|
8.95 |
8.95 |
||
Wire cutter striper |
|
127870 |
1 |
|
5.49 |
5.49 |
||
22 awg 100’ white solid wire |
|
36880 |
1 |
|
5.49 |
5.49 |
||
Battery holder – 2 size D |
|
216389 |
1 |
|
0.89 |
0.89 |
||
Switch |
|
204142 |
1 |
|
0.39 |
0.39 |
||
|
|
|
|
|
|
|
|
|
Data I/O |
|
|
|
|
|
|
|
|
LEDs red |
|
11797 |
|
10 |
|
|
0.19 |
1.90 |
Resistors 330 Ohm 1/8 watt |
|
107967 |
|
100 |
|
|
0.0069 |
0.69 |
273
Appendix 1: Project Kits
8 position DIP switch |
30842 |
|
1 |
|
0.89 |
0.89 |
|
Potentiometer – 10 kOhm |
264410 |
|
1 |
|
1.18 |
1.18 |
|
|
|
|
|
|
|
|
|
PWM Motor Control |
|
|
1 |
|
|
|
|
Motor |
231896CA |
|
|
0.99 |
0.99 |
||
Power Transistor – TIP115 |
288526 |
|
1 |
|
0.48 |
0.48 |
|
Optoisolator – 4N28 |
41013 |
|
1 |
|
0.46 |
0.46 |
|
Diode – 1N4001 |
35975CA |
|
10 |
|
0.03 |
0.30 |
|
9v Connector |
216451 |
|
1 |
|
0.34 |
0.34 |
|
Slotted Interrupter – H21A1 |
114091CL |
|
1 |
|
0.69 |
0.69 |
|
2.2 k Ohm resistor |
108054 |
|
100 |
|
0.0069 |
0.69 |
|
Solder Kit |
|
|
|
|
|
|
|
Description |
|
Part Number |
Quan |
|
Price/Unit |
Total |
|
Soldering iron |
|
208987 |
1 |
|
2.99 |
2.99 |
|
Solder |
|
170456 |
1 |
|
1.39 |
1.39 |
|
Solder wick |
|
410801 |
1 |
|
1.49 |
1.49 |
274