This is a general question about designing firmware for AVR microcontrollers, say, the AtMega16.
I have a routine that I am running through several thousand times per second. The routine is entirely interrupt driven outside of the main loop. I can still run code in the main loop, but it takes too long to operate with several thousand interrupts a second.
I would like to have a routine that scans for incoming data and modifies a variable that the interrupt-driven routine uses. This routine should be asynchronous to the interrupt-driven loop. The variable(s) will change whenever the second routine is ready. Until then, the interrupt-loop should continue running as it was before.
Imagine two processors that share direct CPU access to a common variable. They are both doing different jobs, but one reads the state of the other over the variable. Is there any way of simulating this setup on a single processor? I understand I may have to sacrifice processing power/speed for each routine to make this possible, but my interrupt-driven routine will naturally react to how fast the CPU can run it.