From: Bernhard H. <Ber...@be...> - 2002-12-13 12:33:11
|
> void command(byte cmd){ > byte i=a1->count_of; > > do{ > if(a1->commands[--i]==cmd){ > (*(a1->what_to_do)[i])(); > // Here comes debugging stuff > Disp_dec(cmd); > Disp_char(a1->commands[i]); > break; > } > }while(i); > } > > My Problem: > It always finds the correct command in the command-string after the right number of loops AND it calls a function out of the array BUT it calls ONLY the first function "function1", even if I give him a '6' or a '1' or > whatelse. > > Please give me a breakthrough or at least an idea where am I could be blocked @:? I didn't really dig into your code. But in the loop above an ugly bug concerning liferanges could be involved. Try: volatile byte i = a1->count_of; If this doesn't help, try to define everything as volatile. Or try to disable all opimizations. Bernhard |