Hallo!
Ich habe ein Problem mit dem Starten des TWI:
Nämlich:
Er geht mir nicht mehr aus der While Schleife unter twi_start() raus.

while (!(TWCR & (1<<TWINT)));//Wenn Bus Frei ist:

Außerdem habe ich keine ahnung, wie das mit den auskommentierten zeilen darunter funktionieren soll (habe ich aus dem datenblatt, da ich nicht weiß was in der Konstanten START drinstehen sollte...

Ich bitte um Hilfe.

main:
Code:
#include <avr/io.h>          
#include "uart.h"
#include "twi_bib.h"
#include "lcd.h"
#include <util/delay.h>

#define F_CPU 3000000UL
#define DevPCF8574P  0b01000000      // device address of DS1678, see datasheet
#define Display 0x74

int main(void)
{
	twi_init();                                // init I2C interface
	uart_init();

    DDRB  = 0xff;                              // use all pins on port B for output 
    PORTB = 0xff;
	GICR|=0x20;
	MCUCR=0x00;
	MCUCSR=0x40;
	GIFR=0x20;  
	TIMSK=0x05;
	uart_puts("\n\n\rHallo! Ich melde mich sofort am System an:\n\r");
	uart_puts("\n\n\rProbiere zu Starten:\n\r");
	twi_start();
	PORTB = 0xf0;
	uart_puts("\n\n\rStart hat funtktioniert!");
	while(1);

	return 0;	//Wird nie erreicht

}
verwendete TWI-funktionen:
Code:
void twi_init() {
	TWAR=0x00;//Slave Adress für I2C wird aber nicht benötigt

	//scl-Freq=CPU-Freq/(16+2(TWBR)*4^(Prescaler-Bits(siehe 1)))
	TWBR=0x00;//Da wir 1/16 der CPU-Frequenz wollen.

	TWCR=0x04;//Kein Interrupt/Kein Acknol./TWI Aktivieren
}

short int twi_start() {
	TWCR = (1<<TWINT)|(1<<TWSTA)|(1<<TWEN);//Setzt Start
	while (!(TWCR & (1<<TWINT)));//Wenn Bus Frei ist:
	//if((TWSR&0xF8)!=START)
	//	return 0;
	//else
		return 1;
	
}