Hi Ornini
The error that you are seeing is possibly due to the fact that you are returning from main when you detect that the button has been pressed.
Often the startup code is not designed for main to actually return. It may be implemented as a jump rather than a jump to subroutine (then there is no return address on the stack). Or it may simply have no code following the main call which leads to a crash.
Set a break point at the return line to be sure that it is really getting there and possibly toggle an LED rather than performing "return".
Regards
Mark
P.S. You should also have received a compiler warning since your return is not returning a value, although main is declared as int main(void). It is always important to look carefully at compiler warnings since they sometimes point out things that can really cause a program to fail.
In CodeWarrior you can configure the compiler to demain prototypes so that it will generate an error when it doesn't have the information to do full function checking. This should be activated since it can also avoid potential serious errors when call conventions do not match.
Message Edited by mjbcswitzerland on
2007-07-13 12:46 AM