Difference: RealTimeClock (4 vs. 5)

Revision 52022-12-04 - PeterSchmid

Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Changed:
<
<

Real Time Clock

>
>
Real Time Clock
Intro
Most MCUs integrate a real time clock as peripheral. STM32 MCUs are no different. Many designs have its own 32.768 kHz quartz for precise timing, about 10 ppm without trimming.

RTC Words

  Epoch is 1.1.1970 (Unix time stamp). But valid dates are from 1.1.2000 to 31.12.2099 because of the STM32 RTC peripheral.


Changed:
<
<
time@ ( -- u ) Returns the unix time stamp. time! ( u -- ) Sets the real time clock. .time ( -- ) Prints the current date and time (YYYY-MM-DDTHH:MM:SS ISO 8601).
>
>
time@ ( -- u ) Return the unix time stamp. time! ( u -- ) Set the real time clock. .time ( -- ) Print the current date and time (YYYY-MM-DDTHH:MM:SS ISO 8601).

clktime ( -- u ) hour*10000 + minute*100 + second clkdate ( -- u ) Year*10000 + Month*100 + Day time&date ( -- n1 n2 n3 n4 n5 n6 ) Return the current time and date. n1 second {0...59}, n2 minute {0...59}, n3 hour {0...23}, n4 day {1...31} n5 month {1...12}, n6 year (e.g. 1991) *

 
Changed:
<
<
date Prints date unix style Mon Jan 1 01:57:52 2000
>
>
date Print date unix style Mon Jan 1 01:57:52 2000
  wait-alarm ( -- ) Wait for an alarm
Changed:
<
<
alarm! (h m s -- ) Sets the alarm, invalid parameters e.g. -1 mask the parameter
>
>
alarm! (h m s -- ) Set the alarm, invalid parameters e.g. -1 mask the parameter

ms ( u -- ) Wait at least u millisecond (osDelay) *

*) part of ansification.fs

 
Added:
>
>
 
Changed:
<
<

How to set the current date and time?

>
>

How to Use

Set the current date and time

  Copy the current time stamp from a Unix machine (GNU/Linux box) or from https://www.unixtimestamp.com/:

Line: 83 to 112
 0 Launch! ok.
Added:
>
>

  -- Peter Schmid - 2020-10-11
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback