Hi, Yasser

From reading your posts, I understand you want to scan your EEPROM, increasing address way, on a PORTB.4 H to L transition and decreasing addresses on a L to H transition ...

Ok ...

just use a FOR - NEXT EEPROM reading loop in the main program , if a "H2L" flag is set and a FOR-NEXT-STEP-1 EEPROM loop if a "L2H" flag is set.

Note I use 2 flags to let the initial "no transition" condition usable for something Else...

The ONLY questions will be : do you want to toggle reading order if EEPROM reading is not complete ???
What will you do when EEPROM reading is complete ??? ( seems you wait for further transition ... )

This has a strange smell of "K2000 scanner" or scrolling device ... really don't know why ... LOL !

Alain