Hello all,

I have a problem with a tmr2interrupt. I have programmed a several things but that was lways in loops and now 1 want to change my program.

I use a pic16f628 controller at 4MHz internal ascillator.
I want to use timer2 to generate an interrupt every 2milliseconds.
Only problem is that it never gets to the interruptroutine..
It is for a RTC controlled clock with muxed 7segment displays at two 74hc595 shiftregisters.

Here is the problem code

@ DEVICE pic16F628a, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F628a, WDT_OFF
' Watchdog Timer
@ DEVICE pic16F628a, PWRT_ON
' Power-On Timer
@ DEVICE pic16F628a, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F628a, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F628a, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F628a, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic16F628a, PROTECT_OFF
' Program Code Protection
@ DEVICE pic16F628a, MCLR_OFF
define OSC 4 'runs at 4MHz

INCLUDE "modedefs.bas" 'for shiftout

segments var byte
counter var byte

Symbol tmr2if=PIR1.1
Symbol tmr2ie=PIE1.1
Symbol gie =INTCON.7

'Turn on INTCON.7(GIE) and INTCON.5 (TMR0IE)
INTCON = %10100000
tmr2ie=1
gie=1

on interrupt GoTo isr
GoTo loop

;-----------------------------------------------------------
isr:
'Clear tmr2if
disable
segments = %01111011
counter=%00000000 'only for test. all segments are on.
if hr.6=1 then 'mode indication
segments.7=%1
endif
SHIFTOUT PORTB.0, PORTB.1, LSBFIRST,[counter\8,segments\8] 'data, clock
pulsout PORTA.4,1
'return
INTCON.6 =0
enable
INTCON.6 =0
resume

loop: 'main programloop
repeat
'sec=%00000111
until 0=1
END

The full code is about 10 a4 sides of paper..

I hope that anyone knows what I do wrong and can help me.

Thanks.
Martijn