Page 1 of 1

Timer 0 Querry

Posted: 17 Oct 2010 04:16
by Rob1234
Dear readers

I have a small doubt with timer..

The timer0 of a P16F877a is configured with internal clock source and a Prescaler 1:2 with a Fosc = 1 Mhz.

The datasheet specifies that the Timer0 register reads from 255 - 0 and then rolls over.

when a Value is being entered in the timer0 register.. for example 200 ..

A)does the timer read from 255 to 200 and then rolls over.? setting up the INT flag ..

B)When the timer0 Register is observed on a LCD .. the value goes even below 200 ? How ?

Ur gudiance will be most welcome.

-Rob

Re: Timer 0 Querry

Posted: 17 Oct 2010 06:42
by KaranSoin
The Timer0 Counts up and rolls over (0...254-255-0,1). When it goes from 255 to 0, it generates an interrupt. When you set the tmr0 to 200, it counts up from 200 going to 255 and then rolling over to 0.

Regards

Re: Timer 0 Querry

Posted: 18 Oct 2010 05:02
by Rob1234
Yup karan. Thank u but When observing the TMR0 Register of Timer 0 with a config Internal Oscillator..the value on the LCD..goes even below than the one entered in the TMR0 register.. Mayb i gotta to check ma compiler.hmmm


will do that and post a reply ..
thank u karan..

Re: Timer 0 Querry

Posted: 18 Oct 2010 09:06
by KaranSoin
another suggestion, check how you are displaying the TMR0 on the LCD, if ur LCD routine treats the TMR0 as a signed value, then any value above 127 will interpreted as a -ve number.


cheers

Re: Timer 0 Querry

Posted: 19 Oct 2010 06:11
by Rob1234
Hmm i use Unsigned int & long as my declarations and checked them with both..
I'll post my code ASAP