函数功能是通过TIM2这个16位的计数器的溢出中断实现PE5引脚上的LED改变状态(亮或灭)。
编译错误
#error cpstm8 stm8_interrupt_vector.c:38(8+19) invalid pointer initializer
指向中断向量:{0x82, TIM2_UPD_IRQHandler}, /* irq13 */
网上也说改成{0x82, (interrupt_handler_t)TIM2_UPD_IRQHandler}, /* irq13 */
依旧没用,错误依旧,之前做过TIM4的中断实验,也没出现这样的错误。
中断函数我已经改过了,如下:
#ifdef STM8S903
/**
* @brief Timer5 Update/Overflow/Break/Trigger Interrupt routine.
* @param None
* @retval None
*/
INTERRUPT_HANDLER(TIM5_UPD_OVF_BRK_TRG_IRQHandler, 13)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
}
/**
* @brief Timer5 Capture/Compare Interrupt routine.
* @param None
* @retval None
*/
INTERRUPT_HANDLER(TIM5_CAP_COM_IRQHandler, 14)
{
/* In order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction.
*/
}
#else /*STM8S208, STM8S207, STM8S105 or STM8S103 or STM8AF62Ax or STM8AF52Ax or STM8AF626x */
/**
* @brief Timer2 Update/Overflow/Break Interrupt routine.
* @param None
* @retval None
*/
@far @interrupt void TIM2_UPD_IRQHandler (void)
{
i++;
TIM2_SR1 = 0x00; // 清除更新标志
if(i==10)
{
i=0;
PE_ODR = PE_ODR ^ 0x20; // LED驱动信号取反
}
}
大家给我看看吧,我已经查看对比了很久了....
|