void Tim3init(void) { TIM_TimeBaseInitTypeDef t; NVIC_InitTypeDef n; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //ê±?óê1?ü t. TIM_Period=10000-1; t. TIM_Prescaler=7199; t. TIM_CounterMode=TIM_CounterMode_Up; t. TIM_ClockDivision=TIM_CKD_DIV1; t. TIM_RepetitionCounter=0; TIM_TimeBaseInit(TIM3,&t); TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE); n. NVIC_IRQChannel=TIM3_IRQn; n. NVIC_IRQChannelPreemptionPriority=1; n. NVIC_IRQChannelSubPriority=1; n. NVIC_IRQChannelCmd=ENABLE; NVIC_Init(&n); TIM_Cmd(TIM3,ENABLE); } void TIM3_IRQHandler(void) { if(TIM_GetITStatus(TIM3,TIM_IT_Update)!=RESET) { GPIO_WriteBit(GPIOB,GPIO_Pin_5,(BitAction)(!(GPIOB->ODR&GPIO_Pin_5))); TIM_ClearITPendingBit(TIM3,TIM_IT_Update); } }