Which library to use with a bare ATmega168?

Though I am a proud owner of both an Orangutan and a Baby Orangutan, I confess that I haven’t done much with them… our local club is currently building a kit based on a bare (28-pin DIP package) ATmega168. We like the idea of cutting our teeth on a $2.50 chip rather than even a $20 controller board.

So I’m looking around for a decent library to avoid reinventing the wheel when it comes to essentials like PWM, servo control, serial ports, I2C, etc. I’ve found three decent-looking possibilities:

  1. Procyon AVRlib. But note that the link here doesn’t seem to be to the author’s original site; that one is down, and discussions I’ve found here and there seem to indicate that this library is no longer being maintained, and may not compile cleanly with recent versions of AVR-GCC.

  2. Orangutan-lib. Looks perfect, except that we’re using just the bare chip, not the Orangutan. How much grief is that going to cause me? (Keep in mind that I’m a newbie at embedded development, and may not understand what seems like a simple and obvious problem to you guys.)

  3. Pololu AVR C/C++ library. Looks very recent and well-documented, but also seems very Orangutan/3pi specific, and doesn’t seem to include any servo functions or serial communications.

So… what would you recommend in my situation?

Thanks,
- Joe

AVRFreaks is a good source of code modules for individual functions like serial communications, and there are some useful posts on this forum, but there aren’t any libraries that are not somehow device-specific. Even Procyon AVRLib has lots of #defines leading to code specific for different output devices like LCD displays, etc.

In any event, the hardware that you will connect to an ATmega168 will probably be different than most other examples that you will find on the web. As a particular example consider PWM motor control. There are a very large number of ways that you can connect motor driver chips or transistors to the MPU chip and many different PWM modes and frequencies to choose from.

If you wish to roll your own, the only real option is to carefully read and understand the relevant portions of the mega168 data sheet, your external hardware and to write your own code or cut and paste relevant bits of other people’s code. It is hard work, but you learn a lot. On the other hand, consider how much work went into designing and assembling that $20 controller board!

Cheers, Jim