RTC

所属分类:处理器开发
开发工具:C/C++
文件大小:41KB
下载次数:3
上传日期:2013-01-14 15:35:00
上 传 者JJOrange
说明:  stm32的实时时钟程序,已通过调试,尤其适用于初学者
(STM32 realtime clock program and debugging through,Especially for beginners )

文件列表:
RCT_实时时钟\cortexm3_macro.s (10439, 2008-10-09)
RCT_实时时钟\main.c (9196, 2008-10-09)
RCT_实时时钟\Retarget.c (1236, 2008-10-09)
RCT_实时时钟\SetClock.c (1765, 2008-10-09)
RCT_实时时钟\SetGPIO.c (1192, 2008-10-09)
RCT_实时时钟\SetNVIC.c (936, 2008-10-09)
RCT_实时时钟\SetRTC.c (3500, 2008-10-09)
RCT_实时时钟\SetUsart.c (2132, 2008-10-09)
RCT_实时时钟\stm32f10x_it.c (30072, 2008-10-09)
RCT_实时时钟\stm32f10x_it.h (3973, 2008-10-09)
RCT_实时时钟\stm32f10x_vector.s (13002, 2008-10-09)
RCT_实时时钟\STM32_RTC.opt.bak (6540, 2012-06-29)
RCT_实时时钟\STM32_RTC.plg (162, 2008-10-09)
RCT_实时时钟\STM32_RTC.Uv2.bak (3504, 2009-06-08)
RCT_实时时钟\STM32_RTC.uvopt (88998, 2012-07-12)
RCT_实时时钟\STM32_RTC.uvproj (18154, 2012-07-11)
RCT_实时时钟\STM32_RTC_Opt.Bak (6553, 2004-01-01)
RCT_实时时钟\STM32_RTC_Target 1.dep (5990, 2012-07-12)
RCT_实时时钟\STM32_RTC_Uv2.Bak (3504, 2008-10-09)
RCT_实时时钟\STM32_RTC_uvopt.bak (89004, 2012-07-11)
RCT_实时时钟\UET_GPIO.h (22987, 2008-10-09)
RCT_实时时钟 (0, 2013-01-14)

测试方法:连接好串口 USART_InitStructure.USART_BaudRate = 19200; 下载程序 按复位运行 上位机收到相应信息,并输入时分秒 开发板上LED1会闪烁 /******************************************************************************** * File Name : readme.txt * Design by :TAN/YICHENG * Date First Issued : 03/20/2008 * Description : Description of the RTC Example. *******************************************************************************/ Example description =================== This example demonstrates and explains how to use the RTC peripheral. As an application example, it demonstrates how to setup the RTC peripheral, in terms of prescaler and interrupts, to be used to keep time and to generate Second interrupt. The RTC clock source can be the LSI or LSE, to select the clock to be used uncomment the corresponding line: '#define RTCClockSource_LSI', '#define RTCClockSource_LSE' in 'main.c' file. The RTC clock can be output on the tamper pin (PC.13), to enable this functionality uncomment the corresponding line: 'RTCClockOutput_Enable' in 'main.c' file. The RTC is in the Back-up (BKP) domain, still powered by Vbat when Vdd is switched off, so the RTC configuration is not lost if a battery is connected to Vbat pin. A key value is written in BKP data register1 to indicate if the RTC is already configured. The program behaves as follows: 1. After start-up the program checks the BKP data register1 value: - register1 value not correct: (BKP data register1 value is not correct or not yet programmed, when the first time the program is executed) the RTC is configured and user is asked to adjust time (entered on HyperTerminal) - register1 value correct: this mean that the RTC is configured and the time is displayed on HyperTerminal. 2. When External Reset occurs the BKP domain is not reset and the RTC configuration is not lost 3. When Power On Reset occurs: - if a battery is connected to Vbat pin: the BKP domain is not reset and the RTC configuration is not lost - if no battery is connected to Vbat pin: the BKP domain is reset and the RTC configuration is lost In the RTC ISR a led connected to PB.11 is toggling each 1s. The C library printf function is retarget to the USART1, i.e the printf message is output to the HyperTerminal using USART1. Hardware environment ==================== - Connect a led to pin PB.11 (LD4 on EVAL board). - The USART1 signals (Rx, Tx) must be connected to a DB9 connector using a RS232 transceiver. - Connect a null-modem female/female RS232 cable between the DB9 connector (on EVAL board) and PC serial port. - Hyperterminal configuration: - Word Length = 8 Bits - One Stop Bit - No parity - BaudRate = 115200 baud - flow control: None - Connect a 3V battery on Vbat pin (already mounted onEVAL board) How to use it ============= In order to make the program work, you must do the following : - Create a project and setup all your toolchain's start-up files - Compile the directory content files and required Library files : + stm32f10x_lib.c + stm32f10x_gpio.c + stm32f10x_rcc.c + stm32f10x_rtc.c + stm32f10x_bkp.c + stm32f10x_pwr.c + stm32f10x_nvic.c + stm32f10x_usart.c + stm32f10x_flash.c - Link all compiled files and load your image in Flash - Run the example *********END OF FILE******

近期下载者

相关文件


收藏者