Thanks for Lionelhill's advice.
Just another question. The part where I'm confused is the order of the execution. in the program, it compare flag1 to 10 in the main code, but flag1 is incremented in the keyisr proc. How do they effect each other? I thought when CPU execute the code, it...