I agree with @tarts. The code does nothing and is confusing to read. Please use the names of registers and the bits in them instead of their number.
For example:
BCF PIR1,0 ;what is bit 0 ?
BCF PIR1,TMR1IF ;now we know !
As stated, there is no point in checking if the interrupt flag is set, assuming it was caused by timer1 it must be set to have reached the interrupt routine at all. My advice would be for you to study how interrupts work and what to do inside them. The general rules are:
1. save at least the W and STATUS register as you will probably want these to hold the same value when the main program resumes.
2. as you are in the ISR, one or more interrupt flags must be set, check to see which ones and call the routines to deal with the interrupt situation.
3. clear the interrupt flags.
4. restore the registers you saved in step 1.
5. use the 'retfie' instruction to resume normal program flow.
Also, it is considered good practice to get out of the ISR as quickly as possible. The reason for this is the GIE bit is cleared when the ISR is entered, this prevents other interrupts occuring. It follows that if possible, avoid loops that might delay the ISR from returning. Never change the GIE bit inside the ISR or you risk a crash, it will automatically be restored by the retfie instruction.
Final tip: don't use "$-1" as a destination. On 16F devices it means go back one instruction but on most other PIC families it will not work properly. It is better to use a label and jump to it. for example, dont use:
BTFSS PIR1,0 ; interrupt generate here
GOTO $-1
instead use:
Code:
MyLabel
btfss PIR1,TMR1IF
goto MyLabel
which will work on all PIC families.
Br
ian.