Lea, -----Original Message----- From: Lea |>Also it is a good practice to check te WERR bit (reset during a write |>cycle...) at the begining of the code. |> |You think so?, is it possible that a write command do not preform correctly? |I always read the value after writing to check if write cmd was succeed, I |believe that this is a better way to be shure, don't you think?. Nope. And if a reset interrupts the write process? By checking the WERR bit at the begining of your program, you avoid the case of an error caused by a reset of the uC while the e2prom physical write is in process. This bit is set when a write process is interrupted by a mclr or WDT reset. Then, checking WERR at the begining of the code, you can rewrite the value on the eeprom (remember that the value and the address will still be in EEDATA and EEADR). |also (IMHO) if I include the EEIF check before to write a byte check werr |bit will not be necessary. I suppose that you wanted to said check EEIF flag AFTER the write routine. As i said before, if a reset occurs while the (physical) write operation is running, the uC will restart, the wrote value will be corrupted, and the EEIF flag got nothing to do with it. |thanks, see you. | Leandro J. Laporta (LU2AOQ) mail: lu2aoq@yahoo.com | wrk: Arg. Assoc. for Space Tech. ham: TCP/IP high speed group HSG Best Regards, compa–ero! S.-