Ciao a tutti , visto che l'attiny 45 non ha l'eeprom ho dovuto ,per una mia applicazione , aggiungerla esternamente , la scelta é ricaduta sulle 24c02 - 04 - 08 , soon EEPROM i2c per cui utilizzo la libreria i2c per attiny In versione master
http://arduino.cc/playground/Code/USIi2cE il seguente codice per scrivere sulla eeprom
void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
int rdata = data;
TinyWireM.beginTransmission(deviceaddress);
TinyWireM.send((int)(eeaddress >> 8)); // MSB
TinyWireM.send((int)(eeaddress & 0xFF)); // LSB
TinyWireM.send(rdata);
TinyWireM.endTransmission();
}
// WARNING: address is a page address, 6-bit end will wrap around
// also, data can be maximum of about 30 bytes, because the Wire library has a buffer of 32 bytes
void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
TinyWireM.beginTransmission(deviceaddress);
TinyWireM.send((int)(eeaddresspage >> 8)); // MSB
TinyWireM.send((int)(eeaddresspage & 0xFF)); // LSB
byte c;
for ( c = 0; c < length; c++)
TinyWireM.send(data[c]);
TinyWireM.endTransmission();
}
Modificato da
http://arduino.cc/playground/Code/I2CEEPROMPer leggere i dati dalla eeprom stó utilizzando ic prog
http://www.ic-prog.com/Ho fatto diversi tentativi , sia utilizzando write byte che write page ma riesco a scrivere solo sulla prima riga , ( address 0x0000 - 0x0008) tutte le altre sembrano inaccessibili , ho provato a passare alla funzione valori decimali , esadecimali e binari ma sempre con lo stesso risultato , inoltre molto spesso i dati registrati non sono gli stessi che io desidero , come posso fare?
Ringrazio in anticipo per l'aiuto
Ciao Niko