Hallo zusammen,
ich stehe vor einem Problem: dem Beschreiben eines Maxim DS2431 EEPROMS. Das Auslesen geschieht recht einfach mittels onewire.h und den Zeilen
for ( i = 0; i < 143; i++) //whole mem is 144 Bytes
{
dataread[i] = ds.read(); //writes memory content into array dataread
Serial.print(dataread[i], HEX);
}
Das Problem ist aber, dass ich es nicht hinbekomme, auch nur ein Byte in die verfügbaren Speicherplätze zu schreiben. In der onewire.cpp steht u.a. folges:
// Write a byte. The writing code uses the active drivers to raise the
// pin high, if you need power after the write (e.g. DS18S20 in
// parasite power mode) then set 'power' to 1, otherwise the pin will
// go tri-state at the end of the write to avoid heating in a short or
// other mishap.
//
void OneWire::write(uint8_t v, uint8_t power /* = 0 */) {
uint8_t bitMask;
for (bitMask = 0x01; bitMask; bitMask <<= 1) {
OneWire::write_bit( (bitMask & v)?1:0);
}
if ( !power) {
cli();
DIRECT_MODE_INPUT(baseReg, bitmask);
DIRECT_WRITE_LOW(baseReg, bitmask);
sei();
}
}
Wird daraus jemand schlau und kann mir einen guten Tipp geben, wie man einen bestimmten Wert auf einen bestimmten Speicherplatz schreiben kann?
Vielen Dank für die Hilfe.
Tiesl