interrupt problem on PIC16f1823 - MPLab
You are setting A2 as an output using TRISAbits.TRISA2 = 0;  should be 1.  Easy to remember: a zero looks like an "o" (output) and a 1 looks like an "I" (input).