Newbie? Start here!

1 post / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 8

Stu's Sticky Stuff for Starting Students' Stupification, Edification, and Elucidation

Are you a complete newbie? Or maybe you've been programming PC's for years, but just got handed an AVR project. No matter what your learning level, here it is... :lol: Stu's Complete List O' Newbie Links!

How to ask a question:

First of all, learn how to ask questions the smart way. Please visit this site (There are translations into most languages, so not being able to read English is not an excuse.)

In particular, pay special attention to:
- Before You Ask A Question
Of course if you follow all that advice and still cannot answer the question you have then of course feel free to start a thread about it here - or post onto the end of a related thread (IF it is relevant!).
- Questions Not To Ask
- Examples: Stupid Question, Smart Question
- And, most importantly, How To Ask A Question

While you're at it, please read Help, My "..." Doesn't Work!

Where to ask that question:

You should not post a reply to this thread! Instead, if you have a question that is not answered in one of the tutorials below, ask in the appropriate AVR Freaks community. It is more likely that you will get a fast answer:

o AVR GCC forum - GCC specific questions, including WinAVR and Avr-libc (NOT AVRLib, the UART library - post those to the AVR forum)

o AVR studio 4 forum - AVR Studio problems, not compiler related.

o AVR forum - non-GCC specific questions, questions about commercial compilers and general questions about AVR processors and code for them

o General Electronics forum - Questions about electronics other than AVRs; Relays, thermocouples, LCDs, LEDS, FETs, PLLs, resistors, and stuff like that.

Posting your code with the question:

When you post code, you can make it easier to read by highlighting the code and then pressing the Code button on the submit page.

Your code
   will then

(assuming you put indents in your code)(Weirdness alert: The AVR Freaks site does not like printf formatting strings in the Code section (the percent sign gives it heartburn) - replace the percent sign with @ or * or just remove them, and let us know you did it)

Important Forum Search Tip:

When you are searching for some phrase in the forum and you want the search engine to use all of the terms, you need the "Advanced forum search" engine for this to work. Pressing the little "magnifying glass" icon in the frame to the left is not the Advanced forum search. Instead, go to the top of the page - there you will find a little tab "search forum". That is the Advanced Forum Search. Be sure to click on the "Search for all terms" button.

Now, let's get to the good stuff!! :D

Beginner sites/topics:

Arduino development board Arduino is a simple, cheap, and complete development board for AVR newbies with a large community support. Tools are easy to use, but are limiting for advanced applications.

Arduino newbies should also check out Smiley Micro's new book, An Arduino Workshop. He also sells a kit with all the pieces you need for the projects in the book.

A From-Scratch AVR Tutorial

How to get started with microcontrollers - Part 1
How to get started with microcontrollers - Part 2

Book: Arnie Aardvark's AVR Aperçu - Chuck Baird frequently posts in this forum!

Book and Dev Kits: Smiley Micros - Smiley frequently posts on this forum!
In particular, check out Smiley's Workshop, a series of articles from Nuts and Volts

Embedded Electronics - Beginning with everything

Teensy USB Development Board - < $25

ZBasic microcontrollers, Basic programmed, AVRs inside

:twisted: Evil Mad Scientist page with tool pointers and lots of cool "small" projects you can build!

Learning AVR Assembly:

Beginner's Programming in AVR Assembly

A good site for learning both assembly and some electronics

AVR Instruction Set Document
(Users of the ATXmega series should also get the AVR XMEGA A Manual for more information on the architecture extensions.

AVR Architecture "schematic" (unofficial, of course)

And don't forget books!

Book: Programming Microcontrollers using Assembly Language (Chuck Baird)

Learning C:

AVR C tutorial

Programming Tutorial: C Made Easy

How C Programming Works

GNU C Programming Tutorial

A Tutorial on Pointers and Arrays in C

Macro tutorial and Macro Functions

Guidelines for writing efficient C/C++ code

And don't forget books!

The C Programming Language is essential and should be on every C programmer's shelf. An eBook version of this is available here.

Absolute Beginner's Guide To C

Writing Solid Code I personally recommend this. Lots of good tips.

C Programming for Microcontrollers Featuring ATMEL's AVR Butterfly and the free WinAVR Compiler

Programming and Customizing the AVR Microcontroller

Embedded C Programming and the Atmel AVR Reputedly a good book, but it's expensive (> $75 used)

Again, check out Smiley's books.

Compilers, Simulators, IDEs for the AVR:

AVRStudio 4:
AVR Studio - IDE, Debugger, and Simulator(s) and Assembler free!
NOTE: AVRStudio does not include a C Compiler - see below.
(Using Windows 7/64 bit? Be sure to read alenze's response in this thread)

AVRStudio 5.1:
AVR Studio - IDE, Debugger, and Simulator(s) and Assembler free!

AVRStudio 6:
AVR Studio - IDE, Debugger, and Simulator(s) and Assembler free!

WinAVR - GCC (C/C++ Compiler), AVR-Libc, and other utilities, packed for Windows free!
(Running Linux? Be sure to use Building AVR-GCC on Ubuntu)
(Running 64-bit Vista or Windows 7? Check out WinAVR on Vista 64-bit
Looking for the latest pending/fixed bug list? Check this out.

AVR Eclipse on Ubuntu

IAR Systems - commercial IDE and C/C++ Compiler for lots of processors (demo is free)
(Need to move IAR to GCC? Check out: Porting code from IAR to Avr-GCC)

ImageCraft - commercial C compiler (demo for 45 days is free)

CodeVision AVR - commercial IDE and C/C++ compiler

BASCOM-AVR - Basic for AVR processors

HAPSIM - Nice AVR simulator with peripherals (requires AVR Studio) free!

VMLab - a cool IDE, Simulator, and Debugger; allows adding simulated peripherals free!


No matter what language you are going to program in, you will need to debug your code. I have been programming for close to 40 years, professionally for more than 30, and I constantly debug my code. Try reading the following for debugging hints:

The Practice Of Programming, Chapter 5, Debugging

Other Cool Toys:

Don't use HyperTerminal; that's like using stone knives and bear skins! Instead, check out:
Bray's Terminal - a very nice terminal emulator free!
TeraTerm - a script-able terminal emulator (and what I use!)] free!

KAVRCalc - Calculator of AVR-specific stuff free!

Baud Rate Calculator for ATXmega (Excel spreadsheet) free!

Need a gadget to sniff an I2C or SPI bus and talk back to your PC? Check out Bus Pirate (PIC based - :-P )
SparkFun has them for about $30.

Tutorials and Good Manual Entries:

The AVR Tutorials forum of contains a lot of stuff for you:

Electronics Interfacing 101, a.k.a. Tips & Tricks Especially valuable for 3.3V-to-5V interfacing!

[TUT] [SOFT] WinAVR Beginner's Quick Start Guide for ATMEGA128

[TUT] [SOFT] Setting Up AVRStudio to use GCC

[TUT] [HARD] AVR Programming Methods - "Programming" here means loading your compiled code on to your AVR

[TUT][SOFT] Recovering from a 'locked out' AVR How to recover if you have an ISP "accident" with the fuses

[TUT] [C] Bit manipulation (AKA "Programming 101 For Embedded Code")

[TUT] [C] Basic LEDs & Charlieplexing, mild beginner A good introduction to lighting LEDs (and using C) with your AVR

[TUT] [C] [GCC] How to define a pin as a variable

[TUT] [C] Modularizing C Code: Managing large projects

[TUT][C] Optimization and the importance of 'volatile' in GCC Get a deeper understanding of why breakpoints and watch windows don't always seem to work

[TUT] [C++] AVR C++ Micro How-To

[TUT] Newbie's Guide to AVR Interrupts If you want to use interrupts, start here!
[TUT][SOFT] The traps when using interrupts An excellent introduction to interrupts!
Interrupt Handler Syntax, By Compiler (Look here if for compilers other than AVR-GCC (WinAVR))
(also check out AVR-libc Manual: Interrupts)

[TUT] [SOFT] Using the USART - Serial communications

[TUT] [SOFT] Using the USART - Interrupt driven serial comms

[TUT] [C] Newbie's Guide to AVR Timers
Also check out [TUT] [C] PWM for complete idiots PWM => Pulse Width Modulated, a method for generating an Analog signal from a Digital output.

[TUT] [C] Creating an RTC using an internal counter/timer

[TUT] [C] Using the EEPROM memory in AVR-GCC

[TUT] [C] GCC and the PROGMEM Attribute - how to store strings and constants in program flash instead of SRAM.

[TUT] [C] Newbie's Guide to the AVR Analog-to-Digital Converter (ADC)

[FAQ] [C] Bootloader FAQ A "bootloader" is how you can download new programs into your AVR without the use of external programming hardware. You do have a "chicken and egg" problem, though: the bootloader must first be programmed into the AVR using hardware! (Exception: The AT90USB* parts have a bootloader programmed in at the factory)

[TUT][GCC]Adding CRC and App Length to Hex files

Design Note: Bidirectional SPI

[SOFT] [C] AVRGCC: Monitoring Stack Usage

AVRFreaks Design Notes - lots of cool topics here!

Debugging with the Atmel JTAG-ICE mkII (video tutorial)

[TUT] [SOFT] How to install JTAGICE mkII on Windows 7 x64 (Also works for Dragons!)

Introduction to State Machines for Microprocessors

Good stuff from the AVR-Libc Manual:

AVR-libc Manual: Index

AVR-libc Manual: Frequently Asked Questions

AVR-libc Manual: Memory, Malloc, and External SRAM

AVR-libc Manual: Delay Routines

AVR-libc Manual: Interrupts

AVR-libc Manual: How to Build a Library

AVR-libc Manual: Inline Assembler Cookbook Manual
AVR-libc Manual: Mixing C and Assembly - Demo

AVR-libc Manual: : Standard IO Facilities


The following are "libraries" of routines for talking with peripherals, both internal and external. They are not pre-compiled libraries (as many from the PC world are used to), but instead C source that must be included with your project and compiled. Still, they can be a great head-start on a difficult project.

Pascal Stang's Procyon AVRlib (unsupported, but does lots of cool stuff. Last updated in 2005.)

Peter Fleury's Online AVR Software (also unsupported, includes LCD, UART and I2C (TWI) Master code, among other things. Last compiled on WinAVR 20060125)

Other good topics:

Note that Atmel's code for their app notes is written for the IAR compiler. If you are using GCC (WinAVR), check out Porting code from IAR to Avr-GCC

Care and Feeding of the AVR Dragon

Bit Twiddling Hacks - different ways of doing different logical and arithmetic operations

Fixed-point Math in C Wiki article: Fixed-point math - Q {number format}
Fixed-point math library for the AVR

Introduction to the "Volatile" Keyword

GCC Optimization flags - what they mean

[DIS] [ASM] Dirty Math Tricks: Adventures in Division by Ten

Mechanical Switch Debouncing
Efficient Key Debounce Code

Care and Feeding Of Watchdog Timers

Comparison of all AVR processors

Playing MP3 with AVRs (warning: extra chip required)

Nerd Kits - Tutorials and projects on all kinds of newbie subjects (plus some newbie kits)

Sylvain Bissonnette's Projects site - lots of neat projects!

[TUT] [HARD] Gyros and Accelerometers: The Basics

A list of RTOS links for AVR processors:

First off, check out the RTOS list in the Tutorials section: [TUT][SOFT] RTOS for AVR

All of the following are in the above tutorial

FreeRTOS: A Free RTOS for microcontrollers
Here's FreeRTOS for ATmega2560/1
Here's FreeRTOS for an ATXmega

AvrX: Real-Time Kernel for AVR processors

YAVRTOS: Yet Another Atmel AVR Real-Time Operating System

AVRAsmOS: A tiny OS for small AVRs

pc/OS RTOS Kernel (for larger AVR processors >= mega128)

uSmartX: Non-Preemptive Priority-based Multitask RTOS

Opex - good for smaller RAM, marked "beta"

Femto OS - GPL'ed RTOS, small but commercial folks beware

Advanced Topics:

Linker Scripts

[MAN][HARD][SOFT] Hardware Random Number Generation

If you want to talk to many LEDs but are restricted in port pins, you may want to consider "Charlieplexing":
Charlieplexing: DIY, How-To
Charlieplexing: Reduced Pin-Count LED Display Multiplexing

[TUT] [C] Getting SD/MMC card working painlessly with FatFS
How to use MMC/SDC (Attaching SD cards through the SPI)
FatFS File System Module for AVR

Open source Hardware and Software for AVR Ethernet

PDF Book: The Scientist and Engineer's Guide to Digital Signal Processing

Simple ADC-to-dB conversion algorithm (read whole thread)

USB In A Nutshell - an introduction to USB
Also check out LUFA (AKA MyUSB) - USB AVR Stack (this section needs you to log in)

ICU - International Components for Unicode - portable Unicode libraries

FFT routines for the AVR hand crafted and reported to be quite good.
Also check out Goertzel's Algorithm. For some cases, several calls to a Goertzel is cheaper than an FFT.

World's Simplest XML Parser (in C++)

Other pages with AVR links:

AVR Embedded Microcontroller Resources

The above tutorials may not answer all your questions, but they will allow you to get further faster. You'll be able to ask better questions!

That should hold ya for a while! :D

As always, if you have a question that is not answered in one of the tutorials above, ask in the appropriate AVRFreaks community.

Hope this helps!


PS: For lighter reading, here's "Real Programmers Don't Eat Quiche". This is one of the summarized-and-updated versions of the full treatise here.

Links last tested: 20100420

[cliff: I've made this "sticky" and locked it - if anyone wants to respond please start a new thread about this in AVR Forum]

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!