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

Now, the variables ( ref_coil_count, sensor_coil_count) are not being shared by ISR and MLP (Main Line Program) except flag which has been declared as volatile.