AVR (ATmega8535) programming (C language)

Introduction

This document describes how to write programs for ATmega8535, one of the 8 bit micro controller series - AVR - which is manufactured by Atmel.

I started to write computer programs when I was in university. When I was in the third grade, I learned how to write programs using assembly and C that runs on a small board computer. I also experienced assembling the code by hand into binary and it was a lot of fun when I look it back. I think these experiences led me where I am.

After that I started my career as a software engineer, and I had little opportunity to write programs close to hardware. I had been wanted to control hardware by my own software, so I started to learn how to use AVR and write this document.

Please feel free to make links to this site. If you have something to tell me, please send me an e-mail shown at the bottom of each pages.

You can download sample source code as a tar archive. You can use this source code if you agree to License. You also can download the document archive from here.

Environment

Among a lot of controllers in AVR series, I'm going to focus on ATmega8535. And we'll use avr-gcc on Linux®. Detailed explanations can be available at LECTURE 1 Overview of ATmega8535 and the environment we use

License

All documentation on this site are distributed under the FreeBSD Documentation License. You can see its original form here.

Copyright (c) 2008 Ryo Ichinose
All rights reserved.

Redistribution and use in source (SGML DocBook) and 'compiled' forms 
(SGML, HTML, PDF, PostScript, RTF and so forth) with or without modification, 
are permitted provided that the following conditions are met:

   1. Redistributions of source code (SGML DocBook) must retain the above 
      copyright notice, this list of conditions and the following disclaimer 
      as the first lines of this file unmodified.
   2. Redistributions in compiled form (transformed to other DTDs, converted to 
      PDF, PostScript, RTF and other formats) must reproduce the above copyright 
      notice, this list of conditions and the following disclaimer in the 
      documentation and/or other materials provided with the distribution.

THIS DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

All source code on this site are distributed under the new BSD license. You can see its template by Open Source Initiative here.

Copyright (c) 2008, Ryo Ichinose
All rights reserved.

Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:

   * Redistributions of source code must retain the above copyright 
     notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright 
     notice, this list of conditions and the following disclaimer in the 
     documentation and/or other materials provided with the distribution.
   * Neither the name of the auther nor the 
     names of its contributors may be used to endorse or promote products 
     derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Trademarks

  • Linux ® is the registered trademark of Linus Torvalds in Japan and other countries.
  • Other product names and company names mentioned on this site may also be trademarks or registered trademarks of their respective owners.

References (documents, web links, etc.)

  • Atmel

    Atmel is the manufacturer of AVR micro controller. You can download datasheets at this site.

  • GNU Binutils

    The software which provides basic programming tools like assembler/linker, etc.

  • GCC

    World-famous compiler collection which GNU is maintaining.

  • AVR LibC

    You can download libc for AVR architecture.

  • uisp

    This software enables you to communicate with AVR using your pc when you upload your own program, configure fuse bit, etc.