static?uint32_t?SysTick_Config(uint32_t?ticks) { ????SysTick->CTLR?=?0x00000000;?????????????//控制寄存器復(fù)位 ????SysTick->SR?=?0x00000000;???????????????//狀態(tài)寄存器復(fù)位 ????SysTick->CNT?=?0x00000000;??????????????//計數(shù)器復(fù)位,設(shè)置初始值為0 ????SysTick->CMP?=?ticks;???????????????????//給重加載寄存器賦值 ????NVIC_SetPriority(SysTicK_IRQn,?15);?????//設(shè)置SysTick中斷優(yōu)先級 ????NVIC_EnableIRQ(SysTicK_IRQn);???????????//使能開啟Systick中斷 ????SysTick->CTLR?|=?0x0000000B;????????????//啟動系統(tǒng)計數(shù)器STK(HCLK/8時基) ????return?(0); }
void?drv_tim3_init(u16?hz) { ????TIM_TimeBaseInitTypeDef?TIM_TimeBaseInitStructure?=?{0}; ????NVIC_InitTypeDef????????NVIC_InitStructure?=?{0}; ????RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3,?ENABLE); ????TIM_TimeBaseInitStructure.TIM_Period?=?100000?/?hz; ????TIM_TimeBaseInitStructure.TIM_Prescaler?=?SystemCoreClock?/?100000; ????TIM_TimeBaseInitStructure.TIM_ClockDivision?=?TIM_CKD_DIV1; ????TIM_TimeBaseInitStructure.TIM_CounterMode?=?TIM_CounterMode_Up; ????TIM_TimeBaseInitStructure.TIM_RepetitionCounter?=?0x00; ????TIM_TimeBaseInit(TIM3,?&TIM_TimeBaseInitStructure); ????TIM_ITConfig(TIM3,?TIM_IT_Update,?ENABLE); ????NVIC_InitStructure.NVIC_IRQChannel?=?TIM3_IRQn; ????NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority?=?1; ????NVIC_InitStructure.NVIC_IRQChannelSubPriority?=?3; ????NVIC_InitStructure.NVIC_IRQChannelCmd?=?ENABLE; ????NVIC_Init(&NVIC_InitStructure); ????TIM_Cmd(TIM3,?DISABLE); }
CH32V203配置的兩個中斷,當(dāng)timer3中斷產(chǎn)生的時候,systicKZ中斷就不能正常中斷,中斷嵌套的功能怎么沒有實現(xiàn)?是否是我的配置有問題?
熱門產(chǎn)品 :
CH32X035: 32位USB+USB PD單片機