Atmel application note AVR318 plus source code. Copyright Atmel, license unknown.