初级会员
- 积分
- 184
- 金钱
- 184
- 注册时间
- 2015-3-2
- 在线时间
- 34 小时
|
楼主 |
发表于 2015-11-3 12:02:44
|
显示全部楼层
当进入TIM4中断后,用单步执行还是没法清0 UIF标致,把程序贴片
void TIM4_Configuration(void)
{
/*
TIM4_TimeBaseInit(TIM4_PRESCALER_128 ,200); //煦?128 RES=200
TIM4_ARRPreloadConfig(ENABLE); //赻雄蚾婥妏夔
TIM4_PrescalerConfig(TIM4_PRESCALER_128,TIM4_PSCRELOADMODE_IMMEDIATE);
TIM4_SetAutoreload(200);
TIM4_Cmd(ENABLE); //數杅?妏夔
TIM4_ITConfig(TIM4_IT_UPDATE,ENABLE); //笢剿羲宎
*/
TIM4->IER=0x00;//輦砦笢剿
TIM4->EGR=0X01;//埰勍奀夔載陔岈璃
TIM4->SCR=0x07;// 數杅?奀笘=翋奀笘/128=16MHZ/128=125KHZ=8us
TIM4->ARR=51;//赻雄蚾婥硉˙隅奀笚?=8us*51=408us
TIM4->CNTR=51;//數杅?場硉
TIM4->CR1=0x01;//奀夔數杅?
}
INTERRUPT_HANDLER(TIM4_UPD_OVF_IRQHandler, 23) //隅奀21.2US
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
//TimingDelay_Decrement();
TIM4_ClearITPendingBit(TIM4_IT_UPDATE);
TIM4->SR1 &=0xfe;
}
int main(void)
{
/* 扢离俋窒16M儒淥峈炵苀翋奀笘 */
SystemClock_Init(HSE_Clock);
Key_Init();
LED_Init();
Tim1_Init(); //PC1~4岆PWM 怀堤
TIM4_Configuration();
enableInterrupts(); /* 羲?軞笢剿 */
while (1)
{
Operation();
}
}
|
|