Hi,
kann mir jemand helfen die I2C adresse ins EEPROM zu schreiben.

Hier noch mein code:
Code:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <inttypes.h>
#include "lcd.c"
#include "TWI_Slave.c"

#define F_CPU 8000000UL
// Sample TWI transmission commands
#define LCD_PUTC 			 0x50
#define LCD_GOTOXY 			 0x51
#define LCD_CLEAR 			 0x52
#define LCD_GOHOME 			 0x53
#define LCD_LIGHT 			 0x54

//#define EEMEM __attribute__ ((section (".eeprom"))) 

unsigned char TWI_Act_On_Failure_In_Last_Transmission ( unsigned char TWIerrorMsg )
{
  PORTB = TWIerrorMsg;
  TWI_Start_Transceiver();
                    
  return TWIerrorMsg; 
}

void init_timer2 (void)
{
	cli();									// Interrupts sperren! 
	ASSR &= ~(1<<AS2);
	TCCR2 |= (1<<CS21) | (1<<CS22);	//Timer 2 auf CLK/1024 setzen
	OCR2 = 255;		// Output Compare
	TCNT2=	0x00;		// Timer2 auf 0 stellen
	TIMSK |= (1<<OCIE2) | (1<<TOIE2);	// Timer2 Output Compare Interrupt Enable aktivieren  (Bit setzen) //
	sei();									// Interrrupts freigeben!
}

SIGNAL(SIG_OUTPUT_COMPARE2)
{
	char cSREG;
	cSREG = SREG; // Statusregister puffern in Variable cSREG //
		PORTD &= ~(1<<4);
	SREG = cSREG; 	// Statusregister aus Variable cSREG retten //
}
SIGNAL(SIG_OVERFLOW2)
{
	char cSREG;
 	cSREG = SREG; // Statusregister puffern in Variable cSREG //
		PORTD |= (1<<4);
 	SREG = cSREG; 	// Statusregister aus Variable cSREG retten //
}

int main( void )
{
  unsigned char messageBuf[3];
  unsigned char  TWI_slaveAddress = 0x60 ;
  uint32_t loop = 0;
  //uint8_t eeFooByte = 0x01;
  //uint8_t eeFooByte1 = 0x02;
  
	// timer init
	init_timer2();

  

  DDRD  = 0xFF; // Set to ouput
  DDRB  = 0x00; // Set to input
  DDRC  = 0x00; // Set to input
  PORTB = 0xff;	//activate pullup's
  PORTC = 0xff;	//activate pullup's

	// Own TWI slave address

  TWI_slaveAddress     = 0x60;       //eeprom_read_byte(&eeFooByte);

  // Initialise TWI module for slave operation. Include address and/or enable General Call.
  TWI_Slave_Initialise( TWI_slaveAddress); 
                                                                                  
  sei();

  // Start the TWI transceiver to enable reseption of the first command from the TWI Master.
  TWI_Start_Transceiver();
	
	//LCD_init
	lcd_init(LCD_DISP_ON);
	lcd_clrscr();
	lcd_home();
	lcd_puts("I2C_LCD by\nMartin Funk V1.1");

	while (loop < 500000) loop++;
	
	lcd_clrscr();
	lcd_home();
	lcd_puts("martin.roboter\nbastler.de  V1.1");

	loop = 0;
	while (loop < 500000) loop++;
	lcd_clrscr();
	lcd_home();

	OCR2 = 0;
	
  // This loop runs forever. If the TWI is busy the execution will just continue doing other operations.
  while(1)
  {    
    // Check if the TWI Transceiver has completed an operation.
    if ( ! TWI_Transceiver_Busy() )                              
    {
    // Check if the last operation was successful
      if ( TWI_statusReg.lastTransOK )
      {
    // Check if the last operation was a reception
        if ( TWI_statusReg.RxDataInBuf )
        {
          TWI_Get_Data_From_Transceiver(messageBuf ,3);         
    // Check if the last operation was a reception as General Call        
          if ( !TWI_statusReg.genAddressCall )
          
          {
    // Take action dependant on what slave address that was used in the message
            //if (messageBuf[0] == TWI_slaveAddress)
           // {
			//clear Display
              if (messageBuf[0] == LCD_CLEAR)	//lcd löschen
			  	{
                 lcd_clrscr();                          
				 }
       		  if (messageBuf[0] == LCD_GOTOXY) //lcd gotoxy
			  	{
                 lcd_gotoxy(messageBuf[1],messageBuf[2]);;                          
				 }
              if (messageBuf[0] == LCD_PUTC) //lcd put char
              {
                lcd_putc(messageBuf[1]);

              }
			  if (messageBuf[0] == LCD_GOHOME) //lcd put char
              {
                lcd_home();

              }
			  if (messageBuf[0] == LCD_LIGHT) //lcd put char
              {
			  	OCR2 = messageBuf[1];
              }
          }
        }
    // Check if the TWI Transceiver has already been started.
    // If not then restart it to prepare it for new receptions.             
        if ( ! TWI_Transceiver_Busy() )
        {
          TWI_Start_Transceiver();
        }      
      }
    // Ends up here if the last operation completed unsuccessfully
      else
      {
        TWI_Act_On_Failure_In_Last_Transmission( TWI_Get_State_Info() );
      }
      
    }
  }
}
Mfg Martin