cancel
Showing results for 
Search instead for 
Did you mean: 

STM8SF103 and keeping seconds

mitch
Associate
Posted on August 05, 2015 at 02:59

Hi,

I've been digging and researching how to keep the number of seconds in the system (i.e. system clock). On the STM32 it's quite easy as the clock counts into the 32bit (4x8) registers and you can load this with UTC time and go away happily.

After trying to make heads or tails unsuccessfully of what exactly is available on the STM8 I'm not sure how to approach this.  I can use an external DS1307, but I would much rather use it internally somehow, however I require something that can run off LSI during low power and keep ticking away into a register.

Everything I find seems to point to using interrupts, which would not be ideal during low power active halt.

So, in a nutshell, is there a way to have the peripheral LSI tick into one of the system registers? I cannot seem to find it.

I suppose even if there is only 16 bits available for seconds, that's almost a day - and we have to wake up to reset some counters and increase our epoch in SRAM that's better than nothing.

Thanks,

Mitch

#stm8s-f103-time-clock-seconds
1 REPLY 1
Philipp Krause
Senior II
Posted on August 05, 2015 at 12:53

The STM8 has 16-timers that might be ok for you.

My ''LED timer'' tutorials (which make LEDs blink / count at 1 Hz) at

http://colecovision.eu/stm8/

show how to use them at millisecond resolution for various STM8 variants. Other resolutions can be set by changing the values of the prescaler register.

Philipp

Edit: Fixed typo in ''millisecond''.