Quote Originally Posted by mister_e View Post
OK let's see if i understand your requirement.
  1. When ONLY PORTB.5 = 1 this should go to main
  2. if PORTB.5 = 1 and PORTB.7 = 1, this should write to the memory and after go to main.

but you lost me with the pause 100... i may think you want to perform another operation if PORTB.1 have been hold more than 100 mSec... but not sure.
I have two buttons . One to portb.5 and another to portb.7
Yes ,when i press momentarily the button1 then go to main, and when i press button1 for a long time and when afterwards press button2, then write to the memory.
Sorry fo my bad english.