How can I correctly setup attachInterrupt() in this sketch?

I have thought this way because the variables are not internal registers of the MCU. Let me think about it.