历史上的今天
今天是:2025年02月20日(星期四)
2021年02月20日 | STM8 外部中断配置方法
2021-02-20 来源:eefocus
简介:STM8 外部中断配置方法 1:引用STM8 的中断库 #include "stm8s_exti.h" 2:配置外部中断的触发管脚 GPIO_Init(LEDS_PORT,MB,GPIO_MODE_IN_FL_IT ); 或者 GPIO_Init(LEDS_PORT,MB,GPIO_MODE_IN_PU_IT )...
1:引用STM8 的中断库
#include "stm8s_exti.h"
2:配置外部中断的触发管脚
GPIO_Init(LEDS_PORT,MB,GPIO_MODE_IN_FL_IT );
或者
GPIO_Init(LEDS_PORT,MB,GPIO_MODE_IN_PU_IT );
3:初始化中断
EXTI_DeInit();
EXTI_SetTLISensitivity(EXTI_TLISENSITIVITY_RISE_ONLY);//下降沿触发中断
EXTI_SetExtIntSensitivity((EXTI_PORT_GPIOD),EXTI_SENSITIVITY_RISE_ONLY);
4:中断服务子程序的配置
(1)外部定义中断服务子程序
@far @interrupt void EXTI3 (void)
{
disableInterrupts();
counter ();
enableInterrupts();
}
(2)声明外部中断子程序
extern void EXTI3 ();
(3)配置外部中断子程序向量表
struct interrupt_vector const _vectab[] = {
{0x82, (interrupt_handler_t)_stext},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, EXTI3},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, TIM2_UPD_OVF_TRG_IRQHandler },
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, UART_RI},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
{0x82, NonHandledInterrupt},
};
注:在配置中断实以上三部缺一不可
上一篇:基于IAR的STM8工程的创建
史海拾趣
|
/************************************************************** 320×240 16Bpp TFT LCD功能模块初始化 **************************************************************/ void Lcd_Init(void) { rLCDCON1=( ...… 查看全部问答> |
|
别人的导航软件的手写输入在我定制的CE平台上识别不了,为什么?跟平台定制有关没?CE组件没加? 别人的导航软件的手写输入在我定制的CE平台上识别不了,为什么?跟平台定制有关没?CE组件没加?… 查看全部问答> |
|
上次使用学习了一下Timer,每隔1秒钟中断一次,现在准备实现每隔1S钟读取一下内部的温度值,并在LCD上显示出来。 从手册288页上可以看出,LM3S8962的内部温度传感器有两个目的: 1. 防止温度过高或过低,影响系统芯片正常运行 ...… 查看全部问答> |
|
从《钢铁侠1》到《复仇者联盟》再到《钢铁侠3》,托尼胸前的反应堆,也更新了好几代。高中刚毕业,放假在家,就有了想自己做一个反应堆的想法,然后就开始实践了。 ◆ 第一步:采购原材料(具体如下) ● 网上定制的亚 ...… 查看全部问答> |
|
本帖最后由 DavidZH 于 2014-7-9 00:05 编辑 已经收到的HELP2416开发板,很精致。准备开始学习,按照以往学习其他MCU的经验,先是了解开发板的硬件,然后开始收集相关资料,如下图所示: 一、HELP2416的主芯片是S3C2416 芯片,其内核属于ARMv5 ...… 查看全部问答> |




