大家好,我现在使用STM8S的寄存器操作,在外部中断PD中,想使用定时器TIM2定时,可以TIM2的优先级比外部中断要低,无法运行,我设置ITC_SPR4 &= 0x00;优先级为00了,可是还是运行不起来。求解!!!!!
void Tim2_Time_Upmode_conf(uint8_t TIM2_Prescaler,uint16_t TIM2_Period)
{
TIM2_PSCR = (uint8_t)(TIM2_Prescaler);
/* Set the Autoreload value */
TIM2_ARRH = (uint8_t)(TIM2_Period >> 8);
TIM2_ARRL = (uint8_t)(TIM2_Period);
/* Set or reset the UG Bit */
TIM2_EGR = (uint8_t)TIM2_PSCRELOADMODE_IMMEDIATE;
/*!< Auto-Reload Preload Enable mask. */
TIM2_CR1 |= (uint8_t)MASK_TIM2_CR1_ARPE;
/* Enable the Interrupt sources */
TIM2_IER |= (uint8_t)TIM2_IT_UPDATE;
/*!< Counter Enable mask. */
TIM2_CR1 |= (uint8_t)MASK_TIM2_CR1_CEN;
// ITC_Set(0x0F,1);
ITC_SPR4 &= 0x00;
}
|