What is the maximum execution delay on an ATMEGA2560?
Before I explain, I will note tha I am not providing code or schematics for the reason that my question is independent of those.
Project in development (code not finished) is controlling probably between 20 and 40 LEDs, ultimately powered on 12v, driven by mosfets triggered by logic level from the board. Some of these are used for flash patterns, pulsed on a set delay, as low as 50ms.
To do this, first inputs must be polled, things calculated, stuff done, etc., etc. All this takes time, every microsecond adds up, and so on.
The question is this: WORST CASE SCENARIO, what is the longest execution delay I can expect from any board running an ATMEGA2560, Arduino or otherwise? It doesn't need to be precise. I'm trying to figure out what my margin of error needs to be leveraged against trying to keep the 50ms timing as a magnitude. Is it 4 micros, 40, 400, or 4ms? I will be needing to add up the total delay throughout the entire loop to account for this, as there are a lot of instructions to consider when dealing with so many LEDs, especially if you start getting into clocking shift registers or even decoders.
(I'm also open to suggestions regarding external circuits for multiple-active-output decoding, if anyone has any, in order to reduce overhead).
EDIT: I'm going to rephrase my question. While I do appreciate the criticism, I need to clarify:
What is the longest length of time in microseconds the board will take to complete an execution? For example, I've read that an ISR can take between 60 and 80 clock cycles to complete, without counting code execution time outside the ISR.
Edit2: I want to leave the comment here, also, that I am seeking information to draw my own conclusions. I'm not walking into this completely blind, I have been studying these devices to some degree, that's why I got one. However, in both coding and these MCU platforms, I still do have much to learn. As stated, I have had issues with millis() in the past. That could have just been a code issue. If I find myself needing to use delay() instead, to keep everything happy, that's what I'll do. But I want to compare timing, but I need to know how much time to expect for execution. I've read some saying 4 micros, and some saying nearly a milli... Which is it, and why is it different?