This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Qusetions and Doubts on OS Event Handling

Dear All,

Kindly answer the following question.

I have a task, and set its event "RegulateRPM" from the Timer0 Interrupt. In the task, i have a switch statement that checks the event flag "RegulateRPM" set and accordingly jumps to the routine. The question is, does the routine under the switch-case get executed continuously (as the task is always an infinite loop) untill i dont clear the event flag or does the routine execute once and then i have to set the event again (i am not clearing the event flag)??

__task void TASK_RegulateRPM(void)
{
        uint16_t rx_event;
        os_evt_wait_or(CHECK_EVENT_FLAGS, INFINITE_TIME);       //Wait for an Event to occur
        rx_event = os_evt_get();

        switch(rx_event)
        {
                        case TASK_RPM:

                                if (gMotorRPM < (gFinalRPM))
                                        dacvalue += 1;

                                else if (gMotorRPM > gFinalRPM)
                                        dacvalue -= 1;

                                I2C_DAC_Init(dacvalue);
                        break;
        }
}

gMotorRPM and gFinalRPM are the global floats.

Regards,
Dhaval

0