能给我发一个关于STR912有TIM中断的工程吗?,我的程序始终进不了中断。MDK在添加Linense之前是可以进中断的,添加了licnese之后就不可以了。 我的设置应该没有什么不正确把! void TargetResetInit(void) { /*-------------------- System Clock Config --------------------*/ SCU_MCLKSourceConfig(SCU_MCLK_OSC); FMI_BankRemapConfig(4, 2, 0, 0x400000); /* Set Flash banks size & address */ FMI_Config(FMI_READ_WAIT_STATE_2, FMI_WRITE_WAIT_STATE_0, FMI_PWD_ENABLE, FMI_LVD_ENABLE, FMI_FREQ_HIGH); /* FMI Waite States */
/* Set the PCLK Clock to MCLK/2 */ SCU_PCLKDivisorConfig(SCU_PCLK_Div2); /* USB clock = MCLK/2 = 48MHz */ SCU_USBCLKConfig(SCU_USBCLK_MCLK2);
/* Set the FMI Clock to MCLK/2 */ //SCU_FMICLKDivisorConfig(SCU_FMICLK_Div2);
SCU_PLLFactorsConfig(PLL_NValue, PLL_MValue, PLL_PValue); /* Configure Factors FPLL = 96MHz */ SCU_PLLCmd(ENABLE); SCU_MCLKSourceConfig(SCU_MCLK_PLL);
/* Enable VIC clock */ SCU_AHBPeriphClockConfig(__VIC, ENABLE); SCU_AHBPeriphReset(__VIC, DISABLE);
/* Enable WIU clock */ SCU_APBPeriphClockConfig(__WIU, ENABLE); SCU_APBPeriphReset(__WIU, DISABLE); VIC_DeInit(); }
void TimerStart() { TIM_InitTypeDef TIM_InitStructure;
SCU_APBPeriphClockConfig(__TIM23, ENABLE); SCU_APBPeriphReset(__TIM23, DISABLE);
TIM_DeInit(TIM2);
TIM_StructInit(&TIM_InitStructure);
TIM_InitStructure.TIM_Mode = TIM_OCM_CHANNEL_1; TIM_InitStructure.TIM_OC1_Modes = TIM_TIMING; TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB; TIM_InitStructure.TIM_Prescaler = 0xFF; TIM_InitStructure.TIM_Pulse_Length_1 = 0x753; //10ms定时
/* Initialize the Timer 1 */ TIM_Init (TIM2, &TIM_InitStructure);
TIM_ClearFlag(TIM2, TIM_FLAG_OC1| TIM_FLAG_OC2| TIM_FLAG_TO|TIM_FLAG_IC1|TIM_FLAG_IC2);
VIC_Config(TIM2_ITLine, VIC_IRQ, TIM2_ITLine); VIC_ITCmd(TIM2_ITLine, ENABLE);
/* Enable the Timer Overflow interrupt */ TIM_ITConfig(TIM2, TIM_IT_OC1, ENABLE); /* Start the Timer counter */ TIM_CounterCmd(TIM2, TIM_START); } 请发到我的邮箱yingxf@eastcom.com 谢谢!
|