What should be the reason for the micro-controller to execute last condition though the i/p are changing continuously. This problem occurs in some trials only & not in every trial.
I want to know that what might be the reason for the atmega 16 to execute last condition. I'm using this for certain robotic actions which is depending upon the i/p given to the atmega 16. Microcontroller is not responding sometime as per the i/p given to it. Also when i reset the microcontroller it will give the expected o/p for the same i/p condition.
There is a fault somewhere in your code. You should duplicate the conditions in a simulator until the fault occurs so you can determine where it's coming from.
Without a schematic and the code you're actually using we can't answer.