Setting up RTC_1

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

We are currently using a Timer2 period of 250mSec.
This currently SPEEDS UP the unix time to 4X -  not what we want!

   

I tried calling RTC_1_SetPeriod() with different values - I still get the same clock-rate. I'm not sure what this function accomplishes!

   

I implemented a 'divide-by-4' counter in RTC_1_Update() to correct the problem - unix time is now updated once/second.

   

Is there a more elegant way to fix this problem?

0 Likes
4 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

There usually is another way. Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

I"m wary about posting proprietary source code publicly.

   

 

   

Thanks anyway.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Then supply us with a resuced but working example that you did configure

   

or

   

compare your configuration to the examples provided on Creator's start page.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

If you are still looking for a response, the function:

void RTC_1_SetPeriod(uint32 ticks, uint32 refOneSecTicks)

{

    RTC_1_updateTimePeriod = ticks;

    RTC_1_tickRefOneSec    = refOneSecTicks;

}

first parameter "ticks" actually corresponds to a software divider, in my case I'm using LFCLK 32.768KHz and I need to make RTC work at the normal rate (1 second), so ticks = 1, in other words

RTC_1_SetPeriod(1, 32768);

0 Likes