Thanks by your comments friends, my real app is simple y try to make a ir (infrared) control box that control 4 relays the only that i need is save the last relays status when a possible reset ocurr!, it ensure that there is no change when the power suply is shut down!

last_val is a byte sized var, and I do not write a statemment as

" WRITE 0,1" ;INIT EEPROM

instead I mod the eeprom data memory in MPlab when i burn the Chips, so
How I can detect a power loss?, what is then the best way to do this type of things?
my idea is save the PORTB status ONLY when a new value is reloaded from a an Ir controller, instead each second as the above code is!.

Thanks Again!