RTC Example
Source path: example/rt_device/rtc
Supported Platforms
sf32lb52-lcd_n16r8
sf32lb58-lcd_n16r64n4
Overview
This example demonstrates system time setting, system time reading, and alarm usage based on the RT device framework:
Set date and time, read date and time.
Set Alarm.
Example Usage
Hardware Requirements
Before running this example, you need to prepare a development board supported by this example
Compilation and Programming
Switch to the example project directory and run the scons command to execute compilation:
scons --board=sf32lb52-lcd_n16r8 -j32
Run build_sf32lb52-lcd_n16r8_hcpu\uart_download.bat
, select the port as prompted to download:
$ ./uart_download.bat
Uart Download
please input the serial port num:5
For detailed steps on compilation and downloading, please refer to the relevant introduction in Getting Started Guide.
Expected Results
After the example starts, the serial port outputs as follows:
Set system time to 2024/01/01 08:30:00
10-09 11:01:46:350 set system time (by RT DEVICE): 2024 01 01 08:30:00
10-09 11:01:46:352 current system time: 2024 01 01 08:30:00
Set system time to 2024/02/01 08:30:00
10-09 11:01:46:354 set system time (by RTT API): 2024 02 01 08:30:00
10-09 11:01:46:356 current system time: 2024 02 01 08:30:00
Set one-shot alarm, alarm time is 08:32:00
10-09 11:01:46:358 SET ONESHOT ALARM : [08:32:00]
Alarm triggered
10-09 11:03:46:301 Alarm triggered at 2024 02 01 08:32:00
Periodically get system time (every second)
10-09 11:03:56:885 current system time: 2024 02 01 08:32:11
10-09 11:03:57:852 current system time: 2024 02 01 08:32:12
10-09 11:03:58:880 current system time: 2024 02 01 08:32:13
10-09 11:03:59:847 current system time: 2024 02 01 08:32:14
10-09 11:04:00:861 current system time: 2024 02 01 08:32:15
Exception Diagnosis
Reference Documentation
Update Log
Version |
Date |
Release Notes |
---|---|---|
0.0.1 |
10/2024 |
Initial version |