In the ARTX help say 'It might happen that two isr_evt_set() functions for the same task are called before the task gets a chance to run from os_evt_wait_xx() event waiting function. Of course one event is lost because event flags are not counting objects.' I think if two isr_evt_set() functions should be called, we can set the different bit of the event_flags, then no event will be lost. I mean the isr_evt_set() functions just OR the event_flags but not cover with the event_flags. My idea is right?
"I think if two isr_evt_set() functions should be called, we can set the different bit of the event_flags, then no event will be lost." But then it would be a different event now, wouldn't it? "I mean the isr_evt_set() functions just OR the event_flags..." ORs can't accumulate. ORing a 1 with a 1, resulting in a 1 does not make it more of a 1 now does it? "...but not cover with the event_flags" I don't understand what your are trying to ask with that last part.
Interrupts are in general not predictable. So you never know when an interrupt will happen. If you have a task which need to react on every event received from an interrupt function, then Kernel events are not a good means of doing this. This is because two (or more) interrupts might happen sequentially one after another before the task gets a chance to run. isr_evet_set() function just OR the event flags. Event flags are cleared when os_evt_wait_xx() function resumes it's execution. This is done by the Kernel itself. You should use semaphores instead. Each isr_sem_send() function call will increment number of tokens from a semaphore. In this way, no events are lost. Semaphore objects are counting objects comparing to Kernel event flags, which are not. Franc
View all questions in Keil forum