1666 views|3 replies

1453

Posts

1

Resources
The OP
 

[ST NUCLEO-U575ZI-Q Review] + RTC Electronic Clock [Copy link]

In the manufacturer's routine, an example of using RTC is provided. By combining it with the serial digital tube module, the effect of an electronic clock can be achieved, as shown in the figure below.

Timing effect

When realizing the electronic clock display effect, the RTC clock display function needs to be modified. The modified content is as follows:

static void RTC_TimeShow(uint8_t *showtime)
{
  RTC_DateTypeDef sdatestructureget;
  RTC_TimeTypeDef stimestructureget;
  HAL_RTC_GetTime(&hrtc, &stimestructureget, RTC_FORMAT_BIN);
  Write_Max7219(8,stimestructureget.Hours/10);
  Write_Max7219(7,stimestructureget.Hours%10);
  Write_Max7219(5,stimestructureget.Minutes/10);
  Write_Max7219(4,stimestructureget.Minutes%10);
  Write_Max7219(2,stimestructureget.Seconds/10);
  Write_Max7219(1,stimestructureget.Seconds%10);
}

It is worth noting that the timing value read by the RTC is presented in hexadecimal form, so the numerical display function needs to be modified to realize the display processing of hexadecimal numbers.

The main program to achieve the display effect above is:

int main(void)
{
  HAL_Init();
  HAL_PWR_EnableBkUpAccess();
  __HAL_RCC_BACKUPRESET_FORCE();
  __HAL_RCC_BACKUPRESET_RELEASE();
  SystemClock_Config();
  SystemPower_Config();
  MX_ICACHE_Init();
  MX_RTC_Init();
  BSP_LED_Init(LED2);
  BSP_LED_Init(LED3);
  RTCStatus = 1;
  
  app_MAX7219();
  Init_MAX7219();
  Write_Max7219(3,10);
  Write_Max7219(6,10);
  while (1)
  {
    RTC_TimeShow(aShowTime);
  }
}

In addition, in order to facilitate time adjustment, you can also add parameter input processing functions to perform time correction!

Video demonstration: https://www.bilibili.com/video/BV1pD4y1h7Yu/?vd_source=f302fc0cc3a0425328db53a3b92082ca

This post is from RF/Wirelessly

Latest reply

Review summary: Free application | ST NUCLEO-U575ZI-Q https://en.eeworld.com/bbs/thread-1228653-1-1.html   Details Published on 2023-1-12 09:35
 

6822

Posts

11

Resources
2
 
66666, this one is unique.
This post is from RF/Wirelessly

Comments

Thanks for your support!!!  Details Published on 2022-12-18 23:26
 
 

1453

Posts

1

Resources
3
 

Thanks for your support!!!

This post is from RF/Wirelessly
 
 
 

1w

Posts

204

Resources
4
 

Review summary: Free application | ST NUCLEO-U575ZI-Q https://en.eeworld.com/bbs/thread-1228653-1-1.html

This post is from RF/Wirelessly
Add and join groups EEWorld service account EEWorld subscription account Automotive development circle
Personal signature

玩板看这里:

http://en.eeworld.com/bbs/elecplay.html

EEWorld测评频道众多好板等你来玩,还可以来频道许愿树许愿说说你想要玩的板子,我们都在努力为大家实现!

 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

快速回复 返回顶部 Return list