If it helps, I have commented the ASM code with the equivalent PBP commands. Its hard to say what the problem is without the rest of the program.
Code:ISR: asm movwf wsave ; Save the machine state for restore at end of interrupt routine swapf STATUS, W clrf STATUS movwf ssave movf FSR,w movf fsave movf PCLATH, W movwf psave ; get ready to jump within the ISR page movlw ((INTHAND) >> 8) ; PCLATH=INTHAND>>8 movwf PCLATH btfsc INTCON, INTF ; If INTF=1 THEN GOTO ZeroCrossingInt goto ZeroCrossingInt btfss INTCON, T0IF ; If T0IF=0 THEN GOTO EndInt goto EndInt T0Overflow ; T0Overflow: bcf INTCON, T0IF ; T0IF=0 bsf _oDimmer ; oDimmer=1 goto EndInt ; GOTO EndInt ZeroCrossingInt ; ZeroCrossingInt: bcf INTCON, INTF ; INTF=0 movf _DimmerVal,w ; TMR0=DimmerVal movwf TMR0 bcf _oDimmer ; oDimmer=0 EndInt ; restore the machine state and return from interrupts movf fsave,w movwf FSR ; restore FSR movf psave,w movwf PCLATH ; restore PCH swapf ssave,w movwf STATUS ; restore Status swapf wsave,f swapf wsave,w ; restore WREG retfie endasm





Bookmarks