Teensy 4.1 seconds interrupt

JaredReabow

Well-known member
with T3.6:
///seconds timer interrupt
RTC_IER |= 0x10; // Enable seconds IRQ from RTC peripheral
NVIC_ENABLE_IRQ(IRQ_RTC_SECOND); // Enable seconds IRS function in NVIC
/// end of second timer interrupt

will call the function called: rtc_seconds_isr() every second, can someone clue me in on how to do this with the t4/4.1

I would also like an interrupt ever millisecond, 500ms etc, how can I go about pulling this off?

Thanks.
 
Use an interval timer.
Code:
#include <IntervalTimer.h>
IntervalTimer int_tmr;
.
.
void fn_int_tmr(void)
{
// Interrupt code here
}

// define the interrupt rate in HZ
// e.g. 8kHz
int rate_HZ = 8000;
void setup(void)
{
.
.
    int_tmr.begin(fn_int_tmr,1000000/rate_HZ);
.
.
}

void loop(void)
{
.
.
}

Pete
 
Back
Top