Dear all
I have a rather strange problem, in that an instruction that assign a new value to an enum type is being ignored.
In a header file I defined my enum as
typedef enum
{
my_UndefState = 0,
my_WorkingState1,
my_WorkingState2,
my_WorkingState3
} my_enum_t;
I have also implemented a task routine, running in TIRTOS, as a while loop, in the form
while(1){
Event_pend(...);
do_whatever {
}
}
The enum object is defined as
my_enum_t my_enum = my_UndefState;
within the routine, prior to the while loop.
In the while loop I have different if conditions and depending on those a new value should be assigned to my_enum.
While the code seems to work fine, the value of my_enum never changes, and I don't have any warning or error about that.
The problem appears to persist even if I use an unsigned char in place of my_enum_t to define the my_enum object.
If I use modifiers such as volatile, or if I define my_enum as an extern variable in the header, the problem presents itself as well.
Do you have any idea as to why this enums behaves strangely?
I used others enums without apparent problems.
Regards.
john