2022-12-04 01:36 PM
hello everyone
how can I generate an event when timer operates in input capture mode the counter value goes above the ARR register value?
in my special case I load ARR value to 10000 and CNT register goes ablove ARR value and dosent generate an interrupt "periode elapsed callback" function.
does anyone knos how can I overcome this problem.thanks
2022-12-04 02:01 PM
There's no special way to check whether CNT is above ARR - it's the other way round, you must do everything so that this never happens. This is why ARR preload exists, so that the active ARR changes safely when CNT=0.
Or, after changing ARR without preload, check in software if CNT is lower than ARR or not.
JW
2022-12-04 02:17 PM
In addition to what Jan said, for some uses a down-counter mode can be used as that mode principally cannot have this issue.
2022-12-04 10:00 PM
Most of the time you don't need to care cor the overflow unless measuring multiple overflow periods. Say 16 bit timer capture 0xF000 and afterward 0x1000, 16 bit substract will yield around 0x1000 - 0xF000 = 0x2000