stm32-rtc

所属分类:处理器开发
开发工具:Others
文件大小:180KB
下载次数:19
上传日期:2012-04-11 19:04:02
上 传 者qqasong
说明:  STM32 RTC编程实例,可以正常运行
(STM32 RTC programming examples, can run normally)

文件列表:
projectRTC (0, 2012-02-24)
projectRTC\EWARM (0, 2012-02-24)
projectRTC\EWARM\Backup of Project.ewd (31044, 2007-10-08)
projectRTC\EWARM\Backup of Project.ewp (46682, 2007-10-08)
projectRTC\EWARM\BOOT_FLASH (0, 2012-02-24)
projectRTC\EWARM\BOOT_FLASH\Exe (0, 2012-02-24)
projectRTC\EWARM\BOOT_FLASH\Exe\Project.d79 (129344, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Exe\Project.sim (12360, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\List (0, 2012-02-15)
projectRTC\EWARM\BOOT_FLASH\Obj (0, 2012-02-24)
projectRTC\EWARM\BOOT_FLASH\Obj\cortexm3_macro.r79 (1861, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\main.r79 (24604, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\Project.pbd (1520, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_adc.pbi (889, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_bkp.r79 (6738, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_can.pbi (889, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_dma.pbi (889, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_exti.pbi (891, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_flash.r79 (2755, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_gpio.r79 (12132, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_i2c.pbi (889, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_it.r79 (12967, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_iwdg.pbi (891, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_lib.r79 (1371, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_nvic.r79 (15482, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_pwr.r79 (6328, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_rcc.r79 (17453, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_rtc.r79 (6987, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_spi.pbi (889, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_tim.r79 (39889, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_usart.r79 (16858, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_vector.r79 (6458, 2008-02-14)
projectRTC\EWARM\BOOT_FLASH\Obj\stm32f10x_wwdg.pbi (891, 2008-02-14)
projectRTC\EWARM\cortexm3_macro.s (9356, 2007-10-08)
projectRTC\EWARM\lnkarm_flash.xcl (7677, 2007-10-08)
projectRTC\EWARM\lnkarm_ram.xcl (7656, 2007-10-08)
projectRTC\EWARM\Project.dep (18621, 2008-02-14)
projectRTC\EWARM\Project.ewd (31044, 2008-02-14)
projectRTC\EWARM\Project.ewp (45830, 2008-02-14)
projectRTC\EWARM\Project.eww (161, 2007-10-08)
... ...

/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : readme.txt * Author : MCD Application Team * Version : V1.0 * Date : 10/08/2007 * Description : Description of the RTC Example. ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ 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 Low Speed External (LSE) clock is used as RTC clock source. The RTC clock can be output on the Tamper pin (PC.13). To enable this functionality, uncomment the corresponding line: #define RTCClockOutput_Enable in the main.c file. The RTC is in the backup (BKP) domain, still powered by VBAT when VDD is switched off, so the RTC configuration is not lost if a battery is connected to the VBAT pin. A key value is written in backup data register1 (BKP_DR1) to indicate if the RTC is already configured. The program behaves as follows: 1. After startup the program checks the backup data register1 value: – register1 value not correct: (BKP_DR1 value is not correct or has not yet been programmed when the program is executed for the first time) the RTC is configured and the user is asked to set the time (entered on HyperTerminal). – register1 value correct: this means that the RTC is configured and the time is displayed on HyperTerminal. 2. When a 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 the VBAT pin: the BKP domain is not reset and the RTC configuration is not lost. – If no battery is connected to the VBAT pin: the BKP domain is reset and the RTC configuration is lost. In the RTC interrupt service routine, the LED connected to PC6 toggles every 1 s. The C library printf function is retargeted to the USART1, that is, the printf message is output to the HyperTerminal using USART1. Directory contents ================== stm32f10x_conf.h Library Configuration file stm32f10x_it.h Interrupt handlers header file stm32f10x_it.c Interrupt handlers main.c Main program Hardware environment ==================== - Connect a led to pin PC.06 (LD1 on STM3210B-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 (CN6 on STM3210B-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 on STM3210B-EVAL 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 ******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE******

近期下载者

相关文件


收藏者