Appologies.... You can use the enum the way you have it!! Also you can type define it
Just add this line
my_task_ t task;
Just add this line
my_task_ t task;
C:
#include<reg51.h> //header file
sbit LED1 = P2^0; //LED 1 conncted to port P2 pin 0
sbit LED2 = P2^1; //LED 2 conncted to port P2 pin 1
sbit LED3 = P2^2; //LED 3 conncted to port P2 pin 2
// prototype function
void DoSomething0(void);
void DoSomething1(void);
void DoSomething2(void);
typedef enum
{
task1 ,
task2,
task3
} my_task_t;
int main(void)
{
my_task_t task;
switch (task)
{
case task1:
DoSomething0();
break;
case task2:
DoSomething1();
break;
case task3:
DoSomething2();
break;
}