-
Specifically I'm interested in any timer interrupts used in 'zeptoforth_full-1.0.2.uf2' and 'zeptoforth_full_usb-1.0.2.uf2' - what ones are used for what purposes? I guess there a few vectors just for exception handling, a bunch for serial TX/RX on different devices. But what about other uses, e.g. system timer - is there more than one, and what timers are used to drive this? What frequency does the system timer run at? Somewhere else you wrote: "you could have to save the zeptoforth interrupt handlers and replace them with non-zeptoforth (or just empty : DO-NOTHING ; ) interrupt handlers and restore them when you were done." If I wanted to use the system timer to drive some periodic hardware - if there a way to do this, or should I replace the base call then call the standard Zeptoforth timer interrupt? I read this zeptoforth-1.0.2/docs/words/timer.html, and it seems like alarms would allow me to stable timer interrupt at, say 2ms? And replacing the system interrupt sounds very horrid. Also is the limitations of Forth during interrupt routines documented? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 10 replies
-
I assume the multitasking is done on SysTick. I'm not sure how to get a non-slipping timer with the RP2040 alarm timers, since they are one shot. |
Beta Was this translation helpful? Give feedback.
-
An example of a non-slipping loop using
This will output the counter once every 250 ms while not slipping. |
Beta Was this translation helpful? Give feedback.
-
Would this act as a non-slipping timer? Effectively we start with a fixed start time, then reset the next alarm count. I did think about alternating between two alarms, but this appears not necessary. Obviously I'll need to set the interrupt priorities up correctly.
|
Beta Was this translation helpful? Give feedback.
The only problem with this setup is when
next-robot-tick
plusROBOT-TICK-MICROSECS
is in the past ─ then it will have to wrap around the 32-bit time before the timer interrupt is triggered. This is why it is hard to make a non-slipping timer using the timer interrupt.Here is my attempt at making a non-slipping timer, using your code: