how to store incremental encoder previous position after power on board

Hi,

i am newbie, Working on Arduino Atmega 2560

Setting:- The DC motor shaft is connected to increment Encoder HEDS 5540 and the two channels of Encoder HEDS5540 is connecting to I/Os of Atmega2560. I am reading motor position with Encoder and it is properly reading with incremental counting.

when I reset/ power off the Atmega2560, it is showing/reading "zero" counting instead of actual position counting.

is there any method or sample program to get previous position counting?

please suggest me .

Regards,
Naresh,
Have a great day ..!!

Probably a silly/obvious suggestion but.. save it on EEPROM?