Real Time Clock On Timer1

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Real Time Clock On Timer1

Post by cobra1 »

Hi,

Iv been reading up on making a RTC using Timer1, I see that what i need to do is connect a 32.768khz crystal to T1OS1 and T1OS0, along with a few other components.

In flowcode it gives the option in Timer1, TRANSISTION ON T1CK1 PIN.

So now i guess that the timer is counting the pulses on the 32.768khz crystal. Heres where im confused, underneath it has my clock frequency of 16Mhz, im also using PLL.

How would i go about setting it up so that the intterupt frequency is a nice round number, so as to give an accurate RTC.

Spanish_dude
Posts: 594
Joined: Thu Sep 17, 2009 7:52 am
Location: Belgium
Has thanked: 63 times
Been thanked: 102 times
Contact:

Re: Real Time Clock On Timer1

Post by Spanish_dude »

What's the microcontroller you are using ? (so I can check the datasheet)

But anyways, if you selected "external clock" (or something like that) it will count with that external clock and not your XTAL.
What you'll need to do is choose the appropriate prescaler and if needed, set TMR1 counter register with a begin value.
Setting the prescaler is done in the "interrupt settings" register.

Nicolas

Post Reply