Hi, I am trying to create a timer application which tracks 30minutes, 1Hr, 1h30min, 2H, 2H30min. It does not need to be very precise, variation of upto a 2 seconds is fine.
I am using 16f676 & using 16bit timer1 for this.
PIC-timer calculator says interrupts are generated 524.295mSec @4Mhz & 1:8 prescaler.
I have a word variable which works as a counter for interrupts & tells me that certain time has elapsed.
My problem is that I am not sure if I have calculated the delayset values right as calculator disagrees with me.
Code looks like this:

Code:
delay var word
delaystop var word
redled var porta.0
;---------INTERRUPTS DECLARED HERE------------------------------
ASM
INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
        INT_Handler    TMR1_INT,  _delaystop,   PBP,  yes
    endm
    INT_CREATE               ; Creates the interrupt processor
ENDASM

T1CON=$31

;-------------INTERRUPTS ENABLED HERE-----------------------------
@   INT_ENABLE   TMR1_INT     ; Enable external (INT) interrupts
while 1
if button1 then
delay=0 : delayset=2060 ; 30 minutes
endif

if button2 then
delay=0 : delayset=4120 ; 1Hour
endif

if button3 then
delay=0 : delayset=6180 ; 1Hr 30 minutes
endif

if button4 then
delay=0 : delayset=8240 ; 2 Hours
endif

if button5 then
delay=0 : delayset=10300 ; 2Hrs 30 minutes
endif
wend

delaystop:
delay=delay+1
if delay=delaystop then
      redled=1
endif
@ INT_RETURN