Hi! I have a couple of questions about IntervalTimer and sharing variables safely
https://www.pjrc.com/teensy/td_timing_IntervalTimer.html (Interrupt Context Issues)
I'm working on some steppermotor code with Teensy 4.1
I understand it's considered common practice to disable interrupts when changing shared variables in the main loop as shown in the IntervalTimer example.
But my question/concern is, if i disable interrupts temporarily and that period of no interrupts happens to coincide with the tick of the interval timer, is that interval tick completely skipped altogether ? am i possibly missing a beat of the clock ?
or is this attached interrupt routine just called a tiny bit later, as soon I enable interrupts again ?
If i use volatile variables of 1 byte, like uint8_t, do i still need to disable interrupts when reading the value from the main loop ? what about writing ?
Thanx,
Rob
https://www.pjrc.com/teensy/td_timing_IntervalTimer.html (Interrupt Context Issues)
I'm working on some steppermotor code with Teensy 4.1
I understand it's considered common practice to disable interrupts when changing shared variables in the main loop as shown in the IntervalTimer example.
But my question/concern is, if i disable interrupts temporarily and that period of no interrupts happens to coincide with the tick of the interval timer, is that interval tick completely skipped altogether ? am i possibly missing a beat of the clock ?
or is this attached interrupt routine just called a tiny bit later, as soon I enable interrupts again ?
If i use volatile variables of 1 byte, like uint8_t, do i still need to disable interrupts when reading the value from the main loop ? what about writing ?
Thanx,
Rob