Thanks for reply,
If i used ram using spi i need to write it every time at the end of program, means when power is off ram data are not updated one.
I am trying to add ram using external memory bus connection and change linker file accordingly so that i can use variable which is at external ram address space but i can use it as normal internal variable.
I also power it up using external battery using some batt control ic but which is not important b'coz the circuit is already proven, to hold the data after power off.
Im not thinking about eeprom b'coz data will be write on every scan.
I have read the datasheet of87k22 8.0 external memory bus which make lot of sense but still not able to get how to do that i mean using variable of external ram address as if internal one.
You can suggest me to battery power the cpu but i thing external ram with battery backed is more convenient.