EasyManua.ls Logo

STMicroelectronics STM8 - Stm8_Interrupt_Vector.C (Interrupt Vector Address Part Only); Stm8 S_It.h (Top Part Only); Stm8 S_It.C (Top Part Only)

STMicroelectronics STM8
126 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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);
}
….

Related product manuals