STM32 RTC test successful_only display hours, minutes and seconds

Publisher:闪耀星空Latest update time:2016-08-21 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  STM32 RTC test success_only display hours, minutes and seconds - liuyunqian@yeah - Embedded Learning

Source file location STM32F10x_StdPeriph_Lib_V3.1.2\Project\STM32F10x_StdPeriph_Examples\RTC\Calendar

仔细阅读其中的readme 
摘抄如下
@par How to use it ? 
In order to make the program work, you must do the following :
- Create a project and setup all project configuration
- Add the required Library files :
- stm32f10x_gpio.c 
- stm32f10x_rcc.c 
- stm32f10x_rtc.c 
- stm32f10x_bkp.c 
- stm32f10x_pwr.c 
- misc.c 
- stm32f10x_usart.c
- stm32f10x_exti.c
- system_stm32f10x.c (under Libraries\CMSIS\Core\CM3)
- stm32_eval.c (under Utilities\STM32_EVAL)
- Edit stm32f10x.h file to select the device you are working on.
- Edit stm32_eval.h file to select the evaluation board you will use.

According to previous experience, 
  STM32 RTC test success_only display hours, minutes and seconds - liuyunqian@yeah - Embedded Learning
it is recommended to select use microLIB in the project options.
  STM32 RTC test success_only display hours, minutes and seconds - liuyunqian@yeah - Embedded Learning


Now it's time to go to bed.
  STM32 RTC test success_only display hours, minutes and seconds - liuyunqian@yeah - Embedded Learning

Program address

RTC test successful
Reposted from Tony Embedded Forum, address: http://www.cevx.com/bbs/thread-26329-1-1.html
 

=========================================================

Key code analysis

/**
* @brief Returns the time entered by user, using Hyperterminal.
* @param None
* @retval Current time RTC counter value
*/
uint32_t Time_Regulate(void)
{
uint32_t Tmp_HH = 0xFF, Tmp_MM = 0xFF, Tmp_SS = 0xFF;

printf("\r\n==============Time Settings=====================================");
printf("\r\n Please Set Hours");

while (Tmp_HH == 0xFF)
{
    Tmp_HH = USART_Scanf(23); //If the data input into the HyperTerminal is greater than 23, the HyperTerminal will prompt an error
}
printf(": %d", Tmp_HH);
printf("\r\n Please Set Minutes");
while (Tmp_MM == 0xFF)
{
    Tmp_MM = USART_Scanf(59);
}
printf(": %d", Tmp_MM);
printf("\r\n Please Set Seconds");
while (Tmp_SS == 0xFF)
{
    Tmp_SS = USART_Scanf(59);
}
printf(": %d", Tmp_SS);

/* Return the value to store in RTC counter register */
return((Tmp_HH*3600 + Tmp_MM*60 + Tmp_SS));
}

--------------------------------------

/**
* @brief Displays the current time.
* @param TimeVar: RTC counter value.
* @retval None
*/
void Time_Display(uint32_t TimeVar)
{
uint32_t THH = 0, TMM = 0, TSS = 0;

/* Compute hours */
THH = TimeVar / 3600;
/* Compute minutes */
TMM = (TimeVar % 3600) / 60;
/* Compute seconds */
TSS = (TimeVar % 3600) % 60;

printf("Time: %0.2d:%0.2d:%0.2d\r", THH, TMM, TSS); //\rEnter, the cursor moves to the beginning of this line
}

Keywords:STM32 Reference address:STM32 RTC test successful_only display hours, minutes and seconds

Previous article:STM32 perpetual calendar displays year, month, day, hour, minute, second, week
Next article:stm32 CAN LoopBack self-test mode successful

Recommended ReadingLatest update time:2024-11-15 16:55

Design of digital encryption recording pen based on STM32
  With the widespread application of digital signal processing technology in electronic products, the confidentiality of voice information has also become an important research direction in the field of information processing. The digitization process of analog audio signals includes sampling, quantization and encodin
[Microcontroller]
Design of digital encryption recording pen based on STM32
STM32 system timer SysTick
1. SysTick system timer overview After learning about STM32 interrupts, we need to learn about STM32 timers. Just like the most basic function of a phone is to talk to people, the most basic function of a timer is timing (some STM32 timers are more powerful than you can imagine, of course, not SysTick that we are go
[Microcontroller]
STM32 system timer SysTick
STM32 SPI serial line and HC595 use
/*  Name: STM32 SPI serial line and HC595 use  illustrate: SPI: Serial Peripheral Interface is a high-speed full-duplex communication bus. It is widely used between ADC, LCD and other devices and MCU, where a high communication rate is required. For SPI, there are four main lines: CS, MOSI, MISO, and CLK. Among them
[Microcontroller]
Design of automatic range voltmeter based on STM32
  The whole system in the scheme can be powered by a 9V battery, achieving low power consumption and portability. AC measurement is measured by converting AC signals into DC voltage using the AD637 true RMS conversion chip; input voltage conversion is performed using a reverse amplifier with clamp protection, achievin
[Microcontroller]
Design of automatic range voltmeter based on STM32
Use stm32 to generate triangle wave and sine wave
        I'm preparing for an electronic competition recently, so I've been studying how to use 32 to generate a waveform with controllable frequency.       The functions of 32 are still very powerful. F4 has a main frequency of 168MHZ and the clock frequency can reach 84MHZ. For generating waveforms, if you only wan
[Microcontroller]
Use stm32 to generate triangle wave and sine wave
STM32ADC sampling time, sampling period, sampling frequency calculation method
ADC conversion is the conversion of analog input signals into digital signals by the microcontroller. To read the digital signal, you must wait until the conversion is completed. The completion of a channel reading is called the sampling cycle. Generally speaking, the sampling cycle = conversion time + reading time.  
[Microcontroller]
STM32 Series Chapter 17 - Standby Wake-up
STM32 has three low power modes: Sleep mode: The core is stopped, but peripherals such as NVIC and the system clock Systick are still running. Stop mode: All clocks are stopped; 1.8V core power supply is working; PLL, HIS and HSERC oscillator functions are disabled; register and SRAM contents are retained. Standby
[Microcontroller]
STM32 Series Chapter 17 - Standby Wake-up
STM32 debugging using SWD
Hardware environment: stm32f103vet6, JLink_v8 Software environment: Keil_MDK Debugging process: First, you need to connect the lines. Using JLink_v8 requires connecting 5 lines, namely VCC, nJTRST, SWDIO, and SWCLK. However, nJTRST can be left unconnected, but it will be different when setting. In the setting inte
[Microcontroller]
STM32 debugging using SWD
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号