4.3.6.4 How Do I Share Data Between Two Interrupt Routines?

By their very nature, ISRs do not send results or receive parameters. The only way to share data is by using common data sharing procedures. Examples of these would be by volatile global variables or via specialized accessor functions, which can carefully control access to data, and make your application more robust.

Whenever data is shared across different threads of control, which is really what a interrupt routine is, it is important that the shared data accesses are protected from further interruption as not all accesses are atomic.