Searching \ for '[PIC]: Timer0 funnies' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/time.htm?key=time
Search entire site for: 'Timer0 funnies'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Timer0 funnies'
2001\05\23@195741 by Peter Grey

picon face
I am using a 16F628 and using timer 0 as a timer to generate an interrupt
every 100 microseconds. Within my ISR I have
btfsc intcon,t0if       ;is it a timer 0 interrupt?
goto int1               ;no
bcf     intcon,t0if     ;clear flag
movlw    d'170'         ;load the timer
movwf    tmr0
(snip)
.
.
.
Int1                    ;restore registers and get out

I find this is intermittent in operation. If I put a NOP between the
clearing the t0if and the movlw it is ok. I can move the clearing of the
flag to just before the int1 label and it is NOT ok. If I put 2 NOP's
before loading the timer 0 and the clear flag is just before the int1 label
then it is OK. It appears that a delay of 2 cycles is necessary to allow
correct loading of the timer.

Has anyone had similar experiences? The documentation says that
incrementing is inhibited for 2 cycles after loading but nothing like I
seem to have observed.

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\05\23@205227 by Tony Nixon

flavicon
picon face
Peter Grey wrote:
>
> I am using a 16F628 and using timer 0 as a timer to generate an interrupt
> every 100 microseconds. Within my ISR I have
> btfsc intcon,t0if       ;is it a timer 0 interrupt?
> goto int1               ;no
> bcf     intcon,t0if     ;clear flag
> movlw    d'170'         ;load the timer
> movwf    tmr0
> (snip)


Souldn't that be

 btfss intcon,t0if
 goto intl

--
Best regards

Tony

mICros
http://www.bubblesoftonline.com
spam_OUTsalesTakeThisOuTspambubblesoftonline.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\05\23@214231 by Peter Grey

picon face
At 10:50 AM 5/24/2001 +1000, you wrote:

You are very right, a typing mistake in my email. In the actual code it is
btfss.

Thanks,

Peter
{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...