AVR Tutorial: Switch Input and Debounce

May 15th, 2006

Though an input can be from any number of sources, one of the mose common and the easiest to implement, would be a swith. Due to mechanical properties of a switch, when a switch is closed, there is a period of time in which the electrical connection "bounces" between open and closed. To a microcontroller, this "bouncing" can be interpreted as multiple button pushes. Therefore, we must either build a circuit to supress the "bouncing" or we must do so in our software. This is known as "debouncing a switch".

Read the rest of this entry »


AVR Tutorial: About the Clock Source

May 12th, 2006

The ATMega8 AVR is shipped with it's clock source configured to the internal 1MHz RC oscillator (see: "Calibrated Internal RC Oscillator" in the datasheet p.30). This configuration works fine for many small projects where timing isn't crucial and is also convenient as it reduces parts count (1 crystal and 2 capacitors). However, you may run in to situations where you need a more accurate clock source.

Read the rest of this entry »


AVR Tutorial: Introduction and Digital Output

May 12th, 2006

The AVR family of 8-bit microcontrollers from Atmel are quickly growing in popularity for electronics and robotics hobbiests. Their major selling point for me, as opposed to the PIC microcontrollers from Microchip, are their being designed to be developed using higher languages such as C. This allows them to be developed using the open-source GNU tools (gcc). This works out especially well for me working in Linux.

Read the rest of this entry »


AVR Controlled GP2D120 Distance Sensor

May 11th, 2006

Sharp's GP2D120 (and the GP2D12) is an infared distance sensor which is pretty common in the hobby robotics community. I purshaces a couple of these from DigiKey to use in a small wall-huggin robot. I spent quite a bit of time experimenting with it. This page will provide you with my schematic and AVR gcc source code for my demo file. It simply uses the ADC on an ATMega8 mpu to read the analog output of the GP2D120 and send the distance in centimeters to my laptop through the serial port (actually, through a USB to serial converter).

Read the rest of this entry »


AVR Toggle LED: Test Program for AvrUsb500

February 24th, 2006

This is just a quick, simple little program for an ATMega8 (can easily be adapted to any AVR) that I've setup to test the installation of avr-gcc and the GNU toolchain, avrdude, and my AvrUsb500 USB programmer from tuxgraphics.org.

Read the rest of this entry »


Installing the GNU tools (avr-gcc) for AVRs

February 15th, 2006

I have been using PIC Microcontrollers for my robotics tinkering for a few years. I have also been primarily a Linux user for the last year or two, and have been able to rely on Linux for my work (Web Developer), my school (Computer Science), and all my personal work (robotics, programming, and other nerdy stuff of that nature). I resisted the Atmel AVR Microcontrollers for some time, despite their growing popularity within the hobby robotics community, due to the countless hours I had invested in PICs. However, after learning that the AVRs were designed with C and the GNU tools in mind--a toolset that I use regularly for schoolwork and personal programming projects--I had to give it a further look.

Read the rest of this entry »


Linux Compatible PIC Programmers

May 1st, 2005

Below is a list of programmers known to work with Linux along with the software that is said to work with the particular programmer. You will need to check the websites of the particular programmer and/or software to ensure it will work for your needs. I have not verified all this information, I merely collected it. Enjoy!

Read the rest of this entry »


Testing C Interrupts using Breakpoints in GPSIM

April 26th, 2005

Well, well, well, here we are again. I will be continuing with my new found appreciation of Small Device C Compiler (SDCC) and showing you how to handle interrupts using C-- specifically, the TMR0 interrupt. I will also show you how to simulate this using gpsim, thus learning how to set breakpoints in your code and use the stopwatch feature in gpsim. What's really great, is if you are new to PIC programming and are having a difficulty understanding the concept of the Timer module, interrupts, and prescaler values and what they mean, using GPSIM gives you a realistic visual understanding without having to build a circuit. Pretty handy dandy.
Read the rest of this entry »


Programming PIC’s in Linux using C with SDCC

April 25th, 2005

In my last article, Programming PIC Microcontrollers in Linux, I talked about using using gputils and gpsim to assemble and simulate a basic PIC program. After writing this article, I recieved an email from Martyn Welch regarding the article he recently wrote: Installing and using SDCC on Linux. SDCCs a free C compiler for several small devices, including the PIC microcontroller.
Read the rest of this entry »


Intro to Programming PIC Microcontrollers in Linux

April 19th, 2005

PIC Programming on Linux

I first tried switching to Linux back in 1996-- however, grew frustrated after 2 agonizing weeks of trying to configure ppp to connect to the internet on my speedy 28.8 modem. I continued using, and developting software for, Windows. I grew more and more frustrated with Windows until I reached the breaking point with the new spyware/virus epidemic. I once again attempted the switch to Linux, and to my delight, found it quite painless. I found the install to be VERYeasy and all the drivers and applications I would need were free and readily available-- if not already built into my Linux distribution (at the time that was Fedora Core 1, and is now Fedora Core 3).

Read the rest of this entry »