electroRF
Member
Hi,
I'd like to detect if N Events occurred in a Time Window T, and if so, act on it.
For example, each event is a certain interrupt, and I'd like to know whether N=4 interrupts occurred in a Time Window of T=100ms, and if yes, notify the user.
How would you implement such algorithm?
Note that it could be that 4 events would occur @ t = 80ms, 90ms, 150ms, 179ms, and therefore it means that 4 events occurred in 100ms, which means the user should be notified.
As this will be implemented on embedded chip and not PC, it should be as efficient as possible, Cycles concerning (e.g., setting a Timer to constantly work would be inefficient, as it'd interrupt frequently and therefore "steal" cycles from the system even when no events occur).
These events don't occur frequently.
Thank you
I'd like to detect if N Events occurred in a Time Window T, and if so, act on it.
For example, each event is a certain interrupt, and I'd like to know whether N=4 interrupts occurred in a Time Window of T=100ms, and if yes, notify the user.
How would you implement such algorithm?
Note that it could be that 4 events would occur @ t = 80ms, 90ms, 150ms, 179ms, and therefore it means that 4 events occurred in 100ms, which means the user should be notified.
As this will be implemented on embedded chip and not PC, it should be as efficient as possible, Cycles concerning (e.g., setting a Timer to constantly work would be inefficient, as it'd interrupt frequently and therefore "steal" cycles from the system even when no events occur).
These events don't occur frequently.
Thank you
Last edited: