Thanks a lot Yager!!
It worked perfect with setting the pin as a digital one!
In the same controller, i tried to use an additional external interrupt RB2. It has not been explicitly given as an external interrupt INT2 but as a reprogrammable pin.
RB2/AN8/C2INC/CTED1/PMA3/VMO/REFO/RP5
I do not know what the flags INT2IF, INT2IE, INTEDG2 and INT2IP are associated with in this controller. Let me know how to trigger an interrupt at the RB2 pin.
Thanks again for taking time to help me out!