hallo Wollte mal wissen wie das jetzt geht wenn ich vom Akku ins EEPROM was schreiben will weil ich mus zu erst was ins ColumLatch schreiben weis nicht genau wie das geht kann mir jemand nen beispiel ziegen in Assembler ? wär sehr dankbar
normalerweise geht das über den Befehl movx @dptr,a. Hast du allerdings ein serielles eeprom über iic oder spi dran, dann wird das ganze etwas schwieriger
ja ich will das interne eeprom programmieren so wie du mir das aufgeschrieben hast kenn ich es auch hatt aber nicht funktioniert weil wie gesagt es mus erst in das columnlarch geschrieben werden ist ein RAM und von da aus ins eeprom
habe das datenblatt jetzt nicht vorliegen, aber das klingt schon komisch. normal wäre, wenn du das interne eeprom freischalten müsstest, über ein steuerbit im sfr
Also, in meinem Datenblatt steht drin, was zu tun ist: 10.2 Write Data in the Column Latches Data is written by byte to the column latches as for an external RAM memory. Out of the 11 address bits of the data pointer, the 4 MSBs are used for page selection (row) and 7 are used for byte selection. Between two EEPROM programming sessions, all the addresses in the column latches must stay on the same page, meaning that the 4 MSB must not be changed. The following procedure is used to write to the column latches: • Set bit EEE of EECON register • Load DPTR with the address to write • Store A register with the data to be written • Execute a MOVX @DPTR, A • If needed, loop the three last instructions until the end of a 128 bytes page 10.3 Programming The EEPROM programming consists on the following actions: • Writing one or more bytes of one page in the column latches. Normally, all bytes must belong to the same page; if not, the first page address will be latched and the others discarded. • Launching programming by writing the control sequence (52h followed by A2h) to the EECON register. • EEBUSY flag in EECON is then set by hardware to indicate that programming is in progress and that the EEPROM segment is not available for reading. • The end of programming is indicated by a hardware clear of the EEBUSY flag. Ralf
Reicht Dir auch ne Routine in C? Hier mal ein Ausschnitt von meinen Projekten. Endlich jmd der sich auch noch an diesem sehr schönen Controller vergreift. Ich hab das übrigens nachher mit SDCC compiliert. Das ASM-Listing dazu kann ich Dir ggf. auch noch zukommen lassen wenn Du möchtest. cu, olly... ___________________________________________ Uchar EEPROM_rd(Uchar xdata *address) { // Auf EEPROM umschalten, einzelnes Byte aus EEPROM lesen und im RAM (IDATA, nicht XDATA) lagern, // dann auf XDATA zurückschalten und von IDATA nach XDATA zurückgeben Uchar val; // IDATA bit ea_save = EA; // IDATA, Interrupts speichern EA = 0; // Interrupts ausschalten EECON = 0x02; // XDATA > EEPROM schalten val = *address; // EEPROM > IDATA lesen EECON = 0x00; // EEPROM > XDATA schalten EA = ea_save; // Interrupts wiederherstellen return (val); // IDATA > XDATA zurückgeben } void EEPROM_wrt(Uchar xdata *address, Uchar val) { int i; bit ea_save = EA; // Interruptstatus zwischenspeichern EA = 0; // und ausschalten WD_ACK(); EECON = 0x02; // auf EEPROM mappen *address = val; // pointer auf EEPROM beschreiben EECON = 0x50; // Schreibsequenz einleiten EECON = 0xA0; // Schreibsequenz vollenden while (EECON & 0x01); // warten bis EEPROM zuende geschrieben wurde... for (i = 0; i < 500; i++); // Show-Effekt: Extra-Warteschleife um Schreibvorgang zu verlangsamen, nicht höher setzen weil HW-Watchdog sonst nicht bedient werden kann. Wenn das nicht drin ist, wird seltsamerweise auch nix gespeichert... EECON = 0x00; // EEPROM > XDATA schalten EA = ea_save; // Interruptstatus wiederherstellen }
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.