Peter, unfortunately, this is not my problem. The interrupt doesn't even occur once. I tried everything. The bug (if there is one) must be in the initialization routine (see below). Anyway, many thanks for the help, Hans J. Ziegler >Hans, >I have been using the 16C74 but not timer 2. However, I did have a problem >with the timers when I forgot to clear the interrupt flag in the service >routine. I notice that this is not done in your routines. You may like to >try clearing the flag prior to setting the enable interrupt bits as well. > >Good luck, > > >>Hello. >> >>I got a very urgent problem: >> >>I've got a working project and need to add a clock. I already use all the >>timers, except timer2. Reading the data sheet says: timer2 increases until >it >>matches pr2. Then timer2 will reset and (if there is no postscaler) the >>TMR2IF in the PIR1 register will be set. >>Excellent. But this is exactly what doesn't work. >>timer2 increases, resets on match with pr2, but that damned (sorry) TMR2IF >is >>not set. I am not using a CCP-Module and I do not want to do so. I just want >>timer2 (without any other module) to generate an interrupt after a match >>occured. Perhaps it's just a little bug and I can't find it (since 2 days), >>but I need your help and really do appreciate it. >>Thanks in advance! >> >>Here is my test source (setbank is a macro to select file register bank): >> >> org 0x00 >> goto start >> org 0x04 >> goto service >> >>start >> setbank 1 >> movlw H'10' >> movwf PR2 >> setbank 0 >> clrf TMR2 >> clrf T2CON >> bsf T2CON,TMR2ON >> bcf PIR1,TMR2IF >> setbank 1 >> bsf PIE1,TMR2IE >> setbank 0 >> bsf INTCON,GIE >> bsf INTCON,PEIE >> >> >>loop >> nop >> nop >> goto loop >> >>service >> nop >> nop >> retfie >> >> end >> >> >>Hans J. Ziegler >> >> >Peter Grey >Australia