INCLUE for continuous clock
	
	
		Hi all,
I have been using this little include on PIC16F876A's for ages without a flaw.
But, for some reason it wont work in an 877A.
Any tips or clues would be much appreciated.
cheers
Woodzy
========================================
'FILENAME	:	INT.BAS	
'PROGRAM	:	INCLUE for continuous clock
'DATE		:	01NOV2005
DEFINE INTHAND ROLLOVER
wsave		var	BYTE 	$020 SYSTEM
wsave1		var	BYTE 	$0a0 SYSTEM
wsave2		var	BYTE 	$120 SYSTEM
wsave3		var	BYTE 	$1a0 SYSTEM
ssave		var	BYTE 	BANK0 SYSTEM
psave		var	BYTE 	BANK0 SYSTEM
i_hour		var	BYTE
i_minu		var	BYTE
i_sec		var	BYTE
i_tic		var	BYTE
GOTO AFTERINT				'Jump past interrupthandler
asm
ROLLOVER
;*************************************************  ****************************************
;*************************************************  ****************************************
;
;		If you are using a PIC with 2K or less, 
;		you MUST unremarke the lines that follow.
;
;	movwf	wsave			;only for PICs with 2k or less
;	swapf	STATUS,w		;only for PICs with 2k or less
;	clrf	STATUS			;only for PICs with 2k or less
;	movwf	ssave			;only for PICs with 2k or less
;	movf	PCLATH,w		;only for PICs with 2k or less
;	movwf	psave			;only for PICs with 2k or less
;
;*************************************************  ****************************************
;*************************************************  ****************************************
; interrupcode follows here 
	movlw	0x58
	movwf	TMR1L
	movlw	0x9e			;restart timer from ffff - 9e58 => 5Hz if using 4MHz
	movwf	TMR1H
	decfsz 	_i_tic,f
	goto 	slutint
	incf	_i_sec,f
	movlw	5			;5 = 1Hz if using 4MHz (change to 10 for 8MHz and so on)
 	movwf	_i_tic
	movf	_i_sec,w
	sublw	60
	btfss	STATUS,Z		;check for 60 sec
	goto 	slutint			;no
	clrf	_i_sec			;yes
	incf	_i_minu,f
	movf	_i_minu,w
	sublw	60
	btfss	STATUS,Z		;check for 60 minutes
	goto 	slutint			;no
	clrf	_i_minu			;yes
	incf	_i_hour
	movf	_i_hour,w
	sublw	24
	btfss	STATUS,Z		;check for 24 hours
	goto 	slutint			;no
	clrf	_i_hour			;yes
slutint
	bcf	PIR1,0			;zero tmr1 interrupt flag
;end of interruptcode
; restorecode follows here
	movf	psave,w			;restore
	movwf	PCLATH
	swapf	ssave,w
	movwf	STATUS
	swapf	wsave,f
	swapf	wsave,w
	retfie
endasm
AFTERINT:
INTCON = %00000000			'all interrupts off
PIR1 = %00000000			'zero tmr1 interrupt flag
PIE1 = %00000001			'enable timer1 interrupt
TMR1L = $58
TMR1H = $9e
i_hour = 0				
i_minu = 0
i_sec = 0
i_tic = 5				'this value should be the same as the value of line 8 in the ISR
T1CON = %00110001			'timer1 on, prescaler=1/8
INTCON =  %11000000			'interrupt on
'-----------------------------------------------------------------------------------------
================================================