The atmel recives data ,if data corect it saves it into an eeprom (fm24c256)the only problem i have is that when write is performed it adds at the end of the data string to be saved some trash. If there is someone willing to help plz mail me: geosan1638@yahoo.com
PUTC: JNB TI,$ CLR TI MOV SBUF,A RET SERIN: JNB RI,$ CLR RI MOV A,SBUF RET INIT: setb p3.2 CLR TR1 MOV SCON,#05ah MOV Tmod,#020h mov TH1,#0E8h mov tl1,th1 SETB TR1 MOV A,#0E9h DJNZ ACC,$ jb p3.7,notera ljmp erase_eep mov r1,#040h mov r7,#64 sterram: mov a,0 mov @r1,a inc r1 djnz r7,sterram notera: ljmp START erase_eep: mov dptr,#0000h era1: mov r0,#0ffh lcall wri2c nop nop nop nop inc dptr MOV A,DPH CJNE A,#080H,era1 MOV A,DPL CJNE A,#000H,era1 clr p3.2 ljmp start ;rec overun wri2c: clr wena MOV A,#0a0h LCALL OUTS1 MOV A,dph LCALL OUT1 MOV A,dpl LCALL OUT1 MOV A,R0 LCALL OUT1 LCALL STOP1 setb wena RET Rdi2c: MOV A,#0a0h LCALL OUTS1 MOV A,DPH LCALL OUT1 MOV A,DPL LCALL OUT1 MOV A,#0a1h LCALL CREAD1 RET CREAD1: LCALL OUTS1 LCALL IN1 LCALL STOP1 RET OUTS1: MOV R2,#8 SETB SDA SETB SCL NOP NOP NOP nop CLR SDA NOP NOP NOP nop CLR SCL OTSLP1: RLC A JNC BITSL1 SETB SDA LJMP OTSL11 BITSL1: CLR SDA OTSL11: SETB SCL NOP NOP NOP nop CLR SCL DJNZ R2,OTSLP1 SETB SDA NOP nop SETB SCL NOP NOP NOP nop CLR SCL RET OUT1: MOV R2,#8 OTLP1: RLC A JNC BITL1 SETB SDA LJMP OTL11 BITL1: CLR SDA OTL11: SETB SCL NOP NOP NOP nop CLR SCL DJNZ R2,OTLP1 SETB SDA NOP nop SETB SCL NOP NOP NOP nop CLR SCL RET IN1: MOV R2,#8 SETB SDA INLP1: CLR SCL NOP NOP NOP nop SETB SCL CLR C JNB SDA,INL11 CPL C INL11: RLC A DJNZ R2,INLP1 CLR SCL RET STOP1: CLR SDA NOP NOP NOP nop SETB SCL NOP NOP NOP nop SETB SDA RET add40: mov r3,#040h ad4: inc dptr djnz r3,ad4 ret end
Hi geo, Mean while I go through your code I guess you can try using the following code for you interface,its in assembly... http://www.keil.com/forum/docs/thread2328.asp Rgds Raj Shetgar
hi i have no problem writing in eeprom. the only thing is that after the data i wish to save i get some trash too, wich i don't understand.
Ok, This happens for every byte written or only at the end of some lengthy string written into the EEPROM. Rgds Raj Shetgar
IT HAPPENS IMIDIATLY AFTER INPUT STRING IS OVER. THE INPUT STRING IS WITTEN CORECTLY IN THE EEPROM.