I just found this servo example on Avrfreaks.net.
ATTiny13 @ 9,6MHz
Drawbacks: only 100 steps, and only one servo
#include <avr/io.h>
#include <avr/delay.h>
#include <avr/interrupt.h>
//http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=74861&start=0
volatile unsigned int Tick; // 100KHz pulse
volatile unsigned int sPulse; // Servo pulse variable
volatile unsigned int Tick_20ms; // Servo frame variable
void setup() {
OSCCAL=0x68;
pinMode(4,OUTPUT);
pinMode(3,INPUT);
cli();
TCNT0 = 0;
TCCR0A=0;
TCCR0B=0;
TCCR0A |= (1<<WGM01); // Configure timer 1 for CTC mode
TIMSK0 |= (1<<OCIE0A); // Enable CTC interrupt
TCCR0B |= (1<<CS00); // No prescaler
OCR0A = 95; // Set CTC compare value
sei(); // Enable global interrupts
Tick = 0;
sPulse = 100;
Tick_20ms = 0;
}
void loop()
{
//int val=analogRead(3); //use potmeter on PB3
//sPulse=50+(val/10);
for(int x=50;x<150;x++){
sPulse=x;
_delay_ms( 5 );
}
for(int x=149;x>=50;x--){
sPulse=x;
_delay_ms( 5 );
}
}
ISR(TIM0_COMPA_vect) // 100 KHz interrupt frequency
{
if(Tick >= 2000) // One servo frame (20ms) completed
{
Tick = 0;
Tick_20ms = Tick_20ms + 1;
}
Tick = Tick + 1;
if(Tick <= sPulse) // Generate servo pulse
{
PORTB |= (1<<PB4); // Servo pulse high
}
else
{
PORTB &= ~(1<<PB4); // Servo pulse low
}
}