Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Multiple compares on one intervaltimer?

  1. #1
    Junior Member
    Join Date
    Sep 2018
    Posts
    15

    Multiple compares on one intervaltimer?

    Is it possible to configure an interval timer, such that it can support more than one compare interrupt?

    In example,

    [counter start]
    .
    .
    .
    .
    .
    [compare 0] -> irq_handler_0()
    .
    .
    .
    .
    [compare 1] -> irq_handler_1()
    .
    .
    [STOP (or retrigger if continuously running)]


    Ideall, without breaking the intervaltimer library functionality? If so, I would like to add this functionality to intervalTimer.

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,071
    You can do it the indirect way. Let the interval timer trigger an interrupt routine at the shortest needed interval. Within the latter, you increase a counter and then depending on the counter value, within a swich() statement, you execute the conditional code.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,696
    That capability does not exist in the PIT timers which IntervalTimer uses.

    The FTM timers do have multiple compare units (2 in some FTM timers, 8 in others), so you could do this with those timers. FTM timers are normally used for PWM, and some libraries like FreqMeasure, PulsePosition, AltSoftSerial use them, so conflicts happen if you use any of those on the same FTM timer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •