quick/stupid question

hey, how often does the user_routined_fast get called? i know the user_routines gets called every 28.6ms/38 x/minute…but i was wondering about the “fast”…

If you’re trying to use a timer for autonomous code, I think it updates every 26.8 seconds, just like the normal loop.

As fast as your code will execute.
The more streamlined your code is, the faster it will loop.
The time of each pass through will vary as different decisions are made, different branches are taken, more complex calculations or indexing is performed, interrupts occur.
Each slow-loop will of course slow down the fast loop during which it happens to occur, because of the extra processing.
What we talk of as the “slow-loop” is only a different branch decision made inside the fast loop.

The streamlined default code probably loops roughly on the order of magnitude of 100,000 times per second.
The clock is 10MHz, so no faster than that :slight_smile:

It gets called every loop so the timing depends on the code it runs. Use timers if you want reliable timer info in there and don’t update PWMs (Generate_PWMs() for PWMs 13-16) every loop.

Quick Side Note: One nice thing about the user_routines_fast() function is that it makes a great %load monitor on the processor while you are writing your code if you have an oscilloscope. Just set one of the digital IO pins as an output, and then not (!) it every time you go through the user_routines_fast() loop. any blocks of timing discrepancies in the frequency that gets outputted are places where the processor was busy, so by using your oscilloscope you can figure how much %load your processor has… the more stable high frequency, the lower %load, the less stable frequency, the higher %load.

this measurement can be made most accurately with a digital storage oscilloscope (use the cursors) but can also be done on a normal oscilloscope with a ruler or just an eyeball.

if you need any help on this methodology, just let me know.

-q