Oook Ich glaube der Interrupt geht doch nicht, das komplette Prog. sieht bist jetzt so aus:
Code:
#include <avr/io.h>
#include <avr/eeprom.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>
#include <avr/signal.h>
#include <avr/delay.h>
#include <stdbool.h>
#include "binary.h"

#define EEPROM __attribute__ ((section (".eeprom")))
#define	LED	PA7
#define DDRLED	B10000000
#define DDR1	B00000010

#define US1IN	PA1
#define US1OUT	PA0


uint8_t stop;
volatile uint16_t countUS1 = 0;
volatile uint8_t messungUS1 = false;
volatile uint16_t ergUS1 = 0;

SIGNAL(TIM1_OVF_vect)
{
	//PORTA ^= (1<<LED);	 // LED Togglen
	PORTA &= ~(1<<LED);

	countUS1 = 0;
	PORTA &= ~(1<<US1IN);	// Senden
	_delay_us(10);		// Warten
	PORTA |= (1<<US1IN);
	messungUS1 = true;
}

SIGNAL(TIM0_OVF_vect)
{
	// wird 31250 mal pro Sek aufgerufen also etwas mehr als 1 cm!
	PORTA &= ~(1<<LED);
	if (messungUS1)
	{
		if ((PINA & (1<<US1OUT)) == (1<<US1OUT))	// ist das Signal schon da?
		{
			// ja!
			messungUS1 = false;
			ergUS1 = countUS1;
		}
		else
		{
			countUS1++;
			// cut bei theoretischen 4m
			if (countUS1>730)
				messungUS1 = false;
		}
	}
}


int main (void)
{
	wdt_disable();
	DDRA = DDRLED + DDR1;
	DDRB = 0x0;	// alle als Eingang
	PORTB = 0xff;	// Und Pullups
	stop = false;
	PORTA = 0xff;

	TIMSK |= (1<<TOIE0) | (1<<TOIE1);
	TIMSK &= ~(1<<OCIE1A) & ~(1<<OCIE1B);
	TCCR0 = B00000001;	// CK / 1 für Timer 0
	PLLCSR &= ~(1<<PCKE);	// CK als Timer 1 Clocksource
	TCCR1A = 0;
	TCCR1B = B00001110;	// CK/8192 -> 3.8 mal pro Sek wird der Ovf aufgerufen
	sei();
	PORTA=0x0;
	while(stop==false)
	{
		for (uint8_t i=0;i<10;i++)
			_delay_ms(250);
		PORTA ^= (1 << LED);
		if (ergUS1!=0)
		{		
			for (uint8_t i=0;i<20;i++)
				_delay_ms(250);
			PORTA |= (1 << LED);
			for (uint16_t i=0;i<ergUS1;i++)
				_delay_ms(250);
			PORTA &= ~(1 << LED);
			ergUS1 = 0;
		}
	}
	return 0;
}
Auch mit den alten Vektorbezeichnungen funktioniert es Leider nicht...
Wenn ich jedoch das sei(); weglasse, blinkt zumindest die LED

Könnte mir jemand einen Tipp geben?

Vielen Dank,

Daniel Stengel