You cannot have a timer of 500 ms. Have a timer of say 10 ms and increment a counter on every 10 ms timer interrupt. So, when counter = 50 i.e., 10 ms * 50 = 500 ms you can set a flag. Use this flag in the while(1) loop to execute so other code. After every 10 ms timer interrupt you have to reload the values of timer. So, if your timer values are say 0X1F and 0xDB then in the interrupt routine add the below lines.
//for timer1
TMR1H = 0x1F;
TMR1L = 0xDB;
Remember. You have to reload it every 10 ms interrupt. If you choose 15 ms interrupt then you will be reloading values at every 15 ms.