Ich versuche mich jetzt neu am RN-Wissen Beispiel.
So sieht der Code im Moment aus:

Code:
#include <avr/io.h>         // I/O Port definitions 
#include <avr/interrupt.h>   // Interrupt macros 

#define F_CPU 16000000    
#define SERVOPIN 7 
#define SERVOPORT PORTA 
#define DDRSERVO DDRA 

volatile unsigned char servopos; 

void servo_init() 
{

	TIMSK2 |=(1<<OCIE2); 
	TCCR2 |= (1<<WGM21) | (1<<CS20);   //Prescale=1, CTC mode 
	OCR2 = F_CPU/100000;         //alle 10µS ein IRQ 
	DDRSERVO|=(1<<SERVOPIN); 
};

ISR(TIMER2_COMP_vect) 
{

	static int count; 
	if(count>servopos) 
		SERVOPORT&=~(1<<SERVOPIN); 
	else 
		SERVOPORT|=(1<<SERVOPIN); 
	if(count<2000+servopos) 
		count++; 
	else 
		count=0; 
};

int main(void) 
{

	DDRA = 0xFF; 
	PORTA = 0x00; 

	sei(); 
	servo_init(); 

	servopos=100; 

	while(1) 
	{ 

	} 
	return 0; 
}
Jetzt kriege ich aber folgende Fehlermeldung beim compilieren:
compilieren ... Servos neutral664.cc: In function `void servo_init()':
Servos neutral664.cc:14: error: `OCIE2' was not declared in this scope
Servos neutral664.cc:15: error: `TCCR2' was not declared in this scope
Servos neutral664.cc:16: error: `OCR2' was not declared in this scope
Servos neutral664.cc: At global scope:
Servos neutral664.cc:20: warning: `TIMER2_COMP_vect' appears to be a misspelled signal handler
Mir ist irgendwie nicht klar was er mir damit sagen möchte.
Die berrechnung der PWM ist falsch, das weis ich. Ich wollt erst mal den Timer zum laufen bringen.