David, This is a more detailed section of my code. All code outside the interrupt routine finishes long before the next = interrupt, and just hangs around a loop waiting, hence no need to store = registers. Running the code below works, just polling TMR1IF, and updates my = display (shown in red) If however I enable the code in blue (enabling interrupts) and comment = out code in red, replacing it with a "loop goto loop" statement, my = display is never updated (but should be if interrupts were being called) ORG 0x000 ; processor reset vector goto main ; go to beginning of program ORG 0x004 ; interrupt vector location ;********************************************************************** ;interrupt routine here ;********************************************************************** bank_low CLRWDT btfss PIR1,TMR1IF ;return if it wasn't a timer1 interrupt retfie movlw h'dc' movwf TMR1L ;set timer1 to BDC, i.e. 3036 to give .5sec interval = including prescaler movlw h'0b' movwf TMR1H call updatedisplay bcf PIR1,TMR1IF ;ensure interrupt flag is cleared ready for next = interrupt retfie ;********************************************************************** ;end of interrupt routine ;********************************************************************** main clrf numL clrf numH clrf hund clrf tens clrf ones clrf tens_ones clrf secunit clrf sectens clrf minunit clrf mintens clrf PORTA clrf PORTB clrf PORTC bank_high movlw H'3F' movwf TRISA ;all inputs clrf TRISB ;all outputs clrf TRISC ;all outputs movlw b'10001000' movwf OPTION_REG ;no pullups on port B, prescaler to WDT movlw b'10000000' ;analogue conversion right justified, all inputs = analogue movwf ADCON1 bank_low movlw b'01100001' ;Fosc/8, AN4, A/D on movwf ADCON0 movlw b'00110000' ;set prescaler to 1:8 movwf T1CON movlw h'dc' movwf TMR1L ;set timer1 to BDC, i.e. 3036 to give .5sec interval = including prescaler movlw h'0b' movwf TMR1H bcf PIR1,TMR1IF ;ensure interrupt flag is clear ;movlw b'11000000' ;global interrupts, peripheral only ;movwf INTCON ;movlw b'00000001' ;Timer1 only ;movwf PIE1 bsf T1CON,TMR1ON ;enable timer1 call initdisplay call home0 call stringcharge movlw H'07' call moveto0 call stringtime loop btfsc PIR1,TMR1IF call updatedisplay bcf PIR1,TMR1IF ;ensure interrupt flag is clear=20 CLRWDT goto loop ----- Original Message -----=20 From: David Cary=20 To: PICLIST@MITVMA.MIT.EDU=20 Sent: Tuesday, June 19, 2001 3:48 PM Subject: Re: [PIC]: 16F876 Interrupts Dear Malcolm Peill, Malcolm Peill originally wrote: > bsf T1CON,TMR1ON ;enable timer1 > > call initdisplay > >I know the timer 1 overflow flag gets set, but never calls the = interrupt =3D >vector. Malcolm Peill on 2001-06-19 02:53:13 AM >My code is all in bank 0 and I don't need to save pclath, W reg, = Status etc. >Thanks for the encouragement that the code seems to be ok. I'll have = to keep trying. Sorry. Kneejerk reaction. At first glance, it looked like a common = newbie mistake. I find it hard to believe that you don't need to save W, but if you = say so ... The timer1 setup looks OK to me. Are you sure that the code that = executes after you enable the timer (which you didn't post) doesn't disable the timer = or its PIE interrupt enable bit or the INTCON interrupt enable bits ? -- David Cary -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body