Microcontroller Programming with GNU C
Links Mentioned
APP-IV resources

GCC for Windows
Tools for Linux
 

Links
Home
AWC

Atmel
 


Home
Introduction
Writing a Program
Building your Program
Downloading
Debugging
Modifications
Advanced


NOTICE: THIS IS AN ARCHIVAL COPY OF THIS COURSE. For the latest version, please visit our interactive classroom.

If you've tried to program microcontrollers and found assembly language cumbersome and BASIC or other languages too limiting, maybe you should try C. There are several problems with using C on microcontrollers:

bulletSome architectures are not well-suited to C (for example, the PIC16F-series)
bulletC compilers are often expensive
bulletMany vendors provide buggy C compilers that don't adhere to standards
bulletC programmable hardware is often expensive

AWC's APP-IV overcomes all of these problems. This inexpensive kit (based on our popular GPMPU40 PC board) uses a powerful Atmel ATmega 8 CPU running at 10MIPS. What's more, the kit is especially suited to using the powerful, standard, and free GNU C compiler (gcc). You can create powerful programs easily using this well-respected compiler. Because the ATmega 8 has a true stack, gcc creates highly optimized code for the APP-IV.

You can find out more about the APP-IV on the AWC Web site. Before you proceed, you'll want to download WinAVR (if you are running Windows). If you are running Linux or a similar operating system, you'll want to download gcc and uisp from this Web site (you can also use AVRDude or Atmel's AVR Prog software, if you prefer). You can find links at the top left of this page.

If you are running Windows, you'll probably want to download Atmel's AVR Studio 4, as well. This software is made to run assembly language programs, but it also provide great simulated debugging of C programs! If you prefer, you can also use gcc's debugger, gdb (actually, you'll probably want to use the graphical version called Insight).

The other files you'll want to download are from AWC. These are the APP-IV specific header files. These are not strictly required, but these files allow you to easily use the built-in serial port, generate delays, perform I/O, use the A/D converters, and even interact with a user-supplied LCD display.

So the first step is to build your APP-IV kit (refer to the instructions) and to download and install the software mentioned. If you are impatient (and running Windows) all you absolutely need is in WinAVR.

Speaking of Windows, the WinAVR package includes a version of Cygwin, which provides a Linux-like environment in Windows. If you already have Cygwin, you'll need to hide WinAVR's Cygwin installation from yours (since yours will probably be newer). You can find more details in the APP-IV manual. However, in this tutorial, we'll use the Cygwin tools, so the steps you'll follow will be the same under Windows or Linux.

This tutorial isn't about teaching the C language. My goal is to show you how to write, compile, download, and debug a C program using the APP-IV. You should probably understand a little C before tackling this tutorial.

Home Next