Code:
#include "../inc/asuro.h"
void EEPROM_write(unsigned int uiAddress, unsigned char ucData)
{
/* Wait for completion of previous write */
while(EECR & (1<<EEWE))
;
/* Set up address and data registers */
EEAR = uiAddress;
EEDR = ucData;
/* Write logical one to EEMWE */
EECR |= (1<<EEMWE);
/* Start eeprom write by setting EEWE */
EECR |= (1<<EEWE);
}
unsigned char EEPROM_read(unsigned int uiAddress)
{
/* Wait for completion of previous write */
while(EECR & (1<<EEWE))
;
/* Set up address register */
EEAR = uiAddress;
/* Start eeprom read by writing EERE */
EECR |= (1<<EERE);
/* Return data from data register */
return EEDR;
}
int main(void) {
unsigned i;
unsigned char c;
Init();
/*
EEPROM_write(509,'m');
EEPROM_write(510,'i');
EEPROM_write(511,'c');
*/
SerWrite("\n\n\rInhalt des EEPROMS\n\r10.3.2007 (code by dalmator)\n\n\r",54);
for (i=0;i<512;i++) {
StatusLED(RED);
c=EEPROM_read(i);
StatusLED(GREEN);
SerWrite(&c,1);
}
while (1);
return 0;
}
Das basiert auf einem Thread von damaltor der es aus dem ATMega8-PDF-Handbuch kopiert hat. Ich kann den Thread nur leider mal wieder nicht finden.
gruß
mic
[Edit]
Achtung! Bitte passt das Programm erst an euren asuro an!
Ich möchte nicht in die EEProms aller asuros "gestempelt" werden.
EEPROM_write(509,'m');
EEPROM_write(510,'i');
EEPROM_write(511,'c');
Lesezeichen