Skip to main content
Visitor II
August 23, 2024
Question

generate timer interrupt at CNT value

  • August 23, 2024
  • 1 reply
  • 561 views

Hello,

is there a way to generate a timer interrupt at a certain CNT value? I have not found anything about this.

And if this is possible, is it also possible to change this value on the fly?

Thank you!

    This topic has been closed for replies.

    1 reply

    Super User
    August 23, 2024

    That's called Compare. Just set one of the TIMx_CCRx to the desired compare value, enable the related interrupt by setting TIMx_DIER.CCxE, enable the timer interrupts in NVIC and write the ISR (Interrupt Service Routine).

    I don't use CubeMX but I think this is called "Compare no output" in CubeMX.

    And yes, you can change the compare value in TIMx_CCRx on the fly.

    JW