Time

Timer

We used one in practice session 9.

  • Software timers: service provided by the RTOS, based on at least one hardware timer
  • No limitation (excepted RAM) on the number of timers
  • When the timer reaches its duration, it calls its callback function
  • The callback function is passed a parameter that allows to identify the timer
  • Do not block in the callback function!

Time functions

  • Time is local to the microcontroller
  • Function to get current (local) time
  • Function to convert time (e.g. POSIX format)

In some systems integrating several devices and/or PCs, servers, etc., it may be important to have a common time.

If the devices are connected to the Internet, NTP (Network Time Protocol) can be used.

If not, you're on your own.

Possible solutions:

  • A Real-Time Clock (RTC)
  • A simple message exchange to get (approximate) time
  • Etc.