Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
With a calculator!Suraj143 said:Hi how did you calculate that?
That's different then.Suraj143 said:Hi futz I missed one thing. The Xtal 32.768 KHhz is the Timer1 input clock.Not the system clock.
For the system clock I'm using 4MHz.
futz said:Then you get an interrupt every 1.5 second. I think you might want to set your timer to $8000 instead of $c000.
Your timer gets 32768 clocks per second from that crystal. 32768 = $8000Suraj143 said:futz this is the part i cannot understand.How did you get 1.5 seconds?
Pommie said:If you leave timer1 free running and you check bit 6 of TMR1H, you will find that it alternates every half second. Bit 7 alternates every second - also useful.
Mike.
I don't get it? Thought I understood that thing.Pommie said:Your calculation is slightly wrond due to the fact that Timer1 is incremented. So the delay will be half a second.
In the 16F88 data sheet, in the Timer1 section, it has example code for implementing a RTC.
Mike.
I don't understand how you get 1/2 second. Please enlighten me.Since the register pair is 16 bits wide, counting up to
overflow the register directly from a 32.768 kHz clock
would take 2 seconds. To force the overflow at the
required one-second intervals, it is necessary to preload
it;
Pommie said:Suraj,
Why don't you use the internal 4MHz oscillator to run your code and the 32K crystal to run timer 1. That way you have accurate timing and fast code.
Mike.