STM32中使用TIM中断会影响GIPIO端口吗?
一开始没有TIM中断时正常运行:
SYSTICK_DelayInit();
SYSTICK_Cmd(true);
ds1302_init();
lcd_Init();
// Timer_Init();
while(1){
ds1302_read_realTime();
lcd_write_word(0x01,10,DS1302_data_1);
lcd_write_word(0x40,11,DS1302_data_2);
}
增加TIM中断后,lcd不显示,直接甚至用GPIO进行输出都无结果
如:
SYSTICK_DelayInit();
SYSTICK_Cmd(true);
ds1302_init();
lcd_Init();
Timer_Init();
while(1){
// ds1302_read_realTime();
// lcd_write_word(0x01,10,DS1302_data_1);
// lcd_write_word(0x40,11,DS1302_data_2);
PAout(6)=1;
}
}
PA6仍为低电平
void Timer_Init(void)
{
TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
TIM_InternalClockConfig(TIM3);
TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;
TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;
TIM_TimeBaseInitStructure.TIM_Period = 1999;
TIM_TimeBaseInitStructure.TIM_Prescaler = 8999;
TIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;
TIM_TimeBaseInit(TIM3, &TIM_TimeBaseInitStructure);
TIM_ClearFlag(TIM3, TIM_FLAG_Update);
TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQn;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_Init(&NVIC_InitStructure);
TIM_Cmd(TIM3, ENABLE);
}