I have problems while executing a for loop, I created a static table which contains defined values, then I pass my table as an argument in a function to process. basicly my code looks like the following one:
#define ID_01 0x0000
#define ID_02 0x0001
#define ID_03 0x0002
#define ID_04 0x0003
#define ID_05 0x0004
#define ID_06 0x0005
#define ID_07 0x0006
#define ID_08 0x0007
#define ID_09 0x0008
/*...
*/
#define ID_LAST 0xFFFF
static char table[]={
ID_01, ID_02 ,ID_03, ID_04, .... , ID_LAST}
void process( char *table){
int LastId=0;
char *Command;
for ( Command=table; LastId==0 ; Command++){
switch(Command)
{
case ID_01:
do_stuff01();
break;
case ID_02:
do_stuff02();
break;
...
case ID_LAST:
LastId=1;
break;
default:
break;
}
}
}
I've tried to print some messages to debug but the program does not execute any of the printed even those before the for and after the loop.
But when I've changed my for loop into :
for(i=0;i<10;i++)
all the messages were printed. but I have to process the same way I did in the first place.
PS: this part of code is executed in an operating system task running into a microcontroller and I'm just a beginner.