Hi, i've been trying to simulate a timer interrupt but it doesn't work. Anybody have any suggestion? Based on the code elow tmrcounter should increment on every interrupt so that i can calculate time more than the 16 bit timer register. The scale of the timer is 1:8. Thanks in advance. LIST p=18f252 INCLUDE CounterA equ 0x00 CounterB equ 0x01 CounterC equ 0x02 tmrcounter equ 0x03 W_SAVE equ 0x05 STATUS_SAVE equ 0x06 ORG 0000H GOTO MAIN ORG 0008H GOTO INT_SERV MAIN CLRF PIR2,1 ;Register Overflow CLRF TMR3H CLRF TMR3L MOVLW 0x80 MOVWF INTCON MOVLW 0x02 MOVWF PIE2 ;TMR3 Overflow Interrupt MOVLW B'00110000' MOVWF T3CON BSF T3CON,0 ; Loop for 1 second movlw D'26' movwf CounterC movlw D'119' movwf CounterB movlw D'87' movwf CounterA loop decfsz CounterA,1 goto loop decfsz CounterB,1 goto loop decfsz CounterC,1 goto loop BCF T3CON,0 GOTO FINISH INT_SERV ;Interrupt Routine MOVWF W_SAVE ; save W SWAPF STATUS, W ; save STATUS MOVWF STATUS_SAVE INCF tmrcounter, 1 ;increment on every overflow SWAPF STATUS_SAVE, W MOVWF STATUS; restore W and STATUS SWAPF W_SAVE, F SWAPF W_SAVE, W CLRF PIR2,1 ; CLEAR Register Overflow RETFIE FINISH END >From - wan wanzulhelmi@gmail.com _______________________________________________ http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist