Stm8_Interrupt_Vector.c (Interrupt Vector Address Part Only); Stm8S_It.h (Top Part Only); Stm8S_It.c (Top Part Only) - STMicroelectronics STM8 Manual

Table of Contents

Advertisement

stm8_interrupt_vector.c (Interrupt vector address part only)

....
{0x82, (interrupt_handler_t)TIM1_UPD_IRQHandler}, /* irq11 */
{0x82, (interrupt_handler_t)TIM1_CH1_CCP_IRQHandler}, /* irq12 */
....

stm8s_it.h (Top part only)

#ifndef __STM8S_IT_H
#define __STM8S_IT_H
@far @interrupt void TIM1_UPD_IRQHandler(void);
@far @interrupt void TIM1_CH1_CCP_IRQHandler(void);
/* Includes ------------------------------------------------------------------*/
#include "stm8s.h"
....

stm8s_it.c (Top part only)

#include "stm8s.h"
#include "stm8s_it.h"
extern unsigned int overflow_count;
extern unsigned long pulse_ticks;
extern unsigned long start_time;
extern unsigned long end_time;
void TIM1_UPD_IRQHandler(void)
{
overflow_count++;
TIM1_ClearITPendingBit(TIM1_IT_UPDATE);
TIM1_ClearFlag(TIM1_FLAG_UPDATE);
}
void TIM1_CH1_CCP_IRQHandler(void)
{
end_time = TIM1_GetCapture1();
pulse_ticks = ((overflow_count << 16) - start_time + end_time);
start_time = end_time;
overflow_count = 0;
TIM1_ClearITPendingBit(TIM1_IT_CC1);
TIM1_ClearFlag(TIM1_FLAG_CC1);
}
....

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM8 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF