📄 main.c
字号:
/******************** (C) COPYRIGHT 2003 STMicroelectronics ********************
* File Name : main.c
* Author : MCD Application Team
* Date First Issued : 16/09/2003
* Description : This file gives an example of the use of the PWM input
* feature. The signal periode is stored in the ICAR
* register and the pulse length in the ICBR.
********************************************************************************
* History:
* 03/07/03 : First Version
*******************************************************************************/
#include "71x_lib.h"
#define T3_OCMP_A 0x04
int main(void)
{
u32 i;
#ifdef DEBUG
debug ();
#endif
RTC_FlagClear (RTC_AIR);
RTC_ITConfig (RTC_AIT,DISABLE);
//---------------------------------------------------------------------------
// Initialization
//---------------------------------------------------------------------------
RTC_PrescalerConfig ( 0x8000 );
// Clear Pending Flags
// Configure the GPIO1 Port
// Timer 3 Output Compare function pin (P1.2) configured as Alternate
// function pushpull.
GPIO_Config (GPIO1,T3_OCMP_A,GPIO_AF_PP);
// Initialize the Timer
TIM_Init (TIM3);
// Configure the TIM Prescaler
TIM_PrescalerConfig (TIM3,0x7F);
// Configure PWM Signal :
// Full Period = 7FFF
// Duty Cycle = 50 % ( 3FFFF )
TIM_PWMOModeConfig (TIM3,0x3FFF,TIM_HIGH,0x7FFF,TIM_LOW );
// Start Timer 3
TIM_CounterConfig (TIM3,TIM_START);
// Delay
for(i=0;i<0x2FFFFF;i++);
// Set alarm time = current time + 5 second
????(????()+5);
// Enable the RTC Alarm interrupt
????(????, ENABLE );
// Enter STANDBY mode
PCU_EnterLPM (????);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -