I have a problem. I am using a PIC16F877 and a timer triggered IRQ service routine. Now, I have the problem, that sometimes, the main loop is hanging. My suggestion is, that in certain condition, if the main loop is doing some calculation, the IRQ is occuring, and something is not restored after the IRQ was worked out. I know, that Push/Pull of registers must be done by hand, but I am not sure, if I catched all I need. My IRQ routine is as following: ORG 0x004 ; interrupt vector location movwf w_temp ; save off current W register contents swapf STATUS,W ; move status register into W register clrf STATUS ; ensure file register bank set to 0 movwf status_temp ; save off contents of STATUS register movf PCLATH,W movwf pclath_temp clrf PCLATH call ISR_H ; call the interrupt service codes movf pclath_temp,W movwf PCLATH swapf status_temp,w movwf STATUS ; restore pre-isr STATUS register contents swapf w_temp,f swapf w_temp,w ; restore pre-isr W register contents retfie ; return from interrupt ISR_H ... ... ... return MAIN ... ... ... goto Main Best Jens -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist