Hallo zusammen,
habe da ein Problem eine Chipkarte auszulesen. Da auf der Karte ein EEPROM ST14C02C verbaut ist, gehe ich so vor, als wollte ich z.B. einen 8 beinigen DIP EEPROM-Speicherchip (z.B. 24LCXXX) auslesen.
Hier das Datenblatt:
Datenblatt ST14C02C
Mit Hilfe des I2C Scanners finde ich an den Adressen 0x50 bis 0x57 jeweils ein Gerät.
Um den Inhalt des EEPROM auszulesen verwende ich folgende sketch:
#include <Wire.h>
#define disk1 0x50
void setup(void){
Serial.begin(9600);
Wire.begin();
unsigned int address = 0;
for (address = 0; address < 127; address++)
{
Serial.print(address);
Serial.print("\t");
Serial.print(readEEPROM(disk1, address), HEX);
Serial.println();
}
}
void loop()
{
}
byte readEEPROM(int deviceaddress, unsigned int eeaddress )
{
byte rdata = 0xFF;
Wire.beginTransmission(deviceaddress);
//Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(deviceaddress,1);
if (Wire.available()) rdata = Wire.read();
return rdata;
}
Hier einmal der Inhalt wie ich ihn mit einem Chipdrive auslese:
0000:03 E8 00 01 00 01 07 D3 00 01 00 26 07 CA 03 DE
0010:11 AA 03 DE 00 00 03 DE 00 00 00 00 45 55 03 E8
0020:00 00 07 CA 00 00 11 AA 00 00 00 00 00 00 00 00
0030:00 00 00 8C 00 02 00 03 00 00 00 00 00 00 00 00
0040:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0050:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0060:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0070:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0080:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0090:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00A0:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00B0:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00C0:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00D0:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00E0:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
00F0:FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
Wenn ich //Wire.write((int)(eeaddress >> 8)); // MSB
nicht auskommentiere, zeigt jede Adresse den Wert 255 bzw. FF.
Auskommentiert erhalte ich die richtigen Werte, bis auf die erste
Zeile, hier stimmt etwas nicht. Vermutlich hängt es mit der bitshift
Operation zusammen?
0000: 61 FF FF FF FF FF FF FE 00 10 00 26 07 CA 27 06
0010: Ab hier stimmen die Werte........
Ich komme einfach nicht auf die Lösung obwohl es bestimmt ganz trivial ist