打印
[技术问答]

关于外部中断奇特现象

[复制链接]
419|12
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
dtmcp|  楼主 | 2020-4-2 13:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我用两路外部中断读取外部的方波信号,用仿真调试可以正常进入中断程序,但是读ISRC寄存器都是0,搞的无法判断中断源,不知大家有没有遇到过

使用特权

评论回复
沙发
dtmcp|  楼主 | 2020-4-2 13:15 | 只看该作者
顺便提个醒,原来新唐函数的BUG,害人啊  第15脚应用有风险 ,  IO操源代码如下:if ((i32Bit < 0) || (i32Bit >= 15)),

163605e857481b08ca.png (24.34 KB )

163605e857481b08ca.png

使用特权

评论回复
板凳
jasontu| | 2020-4-6 09:46 | 只看该作者
那個料號?

使用特权

评论回复
地板
dtmcp|  楼主 | 2020-4-8 10:34 | 只看该作者
目前是NUC130的问题,其它没有注意

使用特权

评论回复
5
jasontu| | 2020-4-9 07:58 | 只看该作者
不会呀,一般port是0-15, 最多16根脚

使用特权

评论回复
6
玛尼玛尼哄| | 2020-4-9 09:27 | 只看该作者
这个如果不用BIT15很难发现啊。

使用特权

评论回复
7
玛尼玛尼哄| | 2020-4-9 09:27 | 只看该作者
坑够深,

使用特权

评论回复
8
zhuomuniao110| | 2020-4-9 22:14 | 只看该作者
楼主,你这个库函数好像很古老啊。

使用特权

评论回复
9
zhuomuniao110| | 2020-4-9 22:28 | 只看该作者
你去官网下载最新的看看。

使用特权

评论回复
10
zhuomuniao110| | 2020-4-9 22:29 | 只看该作者
还真是的。

使用特权

评论回复
11
zhuomuniao110| | 2020-4-9 22:29 | 只看该作者
/**************************************************************************//**
* [url=home.php?mod=space&uid=288409]@file[/url]     gpio.c
* [url=home.php?mod=space&uid=895143]@version[/url]  V3.00
* $Revision: 2 $
* $Date: 15/05/04 3:27p $
* [url=home.php?mod=space&uid=247401]@brief[/url]    GPIO driver source file
*
* @note
* Copyright (C) 2014 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/

#include "NUC100Series.h"

/** @addtogroup Standard_Driver Standard Driver
  @{
*/

/** @addtogroup GPIO_Driver GPIO Driver
  @{
*/

/** @addtogroup GPIO_EXPORTED_FUNCTIONS GPIO Exported Functions
  @{
*/

/**
* @brief       Set GPIO operation mode
*
* @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE or PF.
* @param[in]   u32PinMask  The single or multiple pins of specified GPIO port.
*                          It could be BIT0 ~ BIT15 for PA, PB, PC, PD and PE GPIO port.
*                          It could be BIT0 ~ BIT3 for PF GPIO port.
* @param[in]   u32Mode     Operation mode. . It could be \n
*                          GPIO_PMD_INPUT, GPIO_PMD_OUTPUT, GPIO_PMD_OPEN_DRAIN, GPIO_PMD_QUASI.
*
* [url=home.php?mod=space&uid=266161]@return[/url]      None
*
* [url=home.php?mod=space&uid=1543424]@Details[/url]     This function is used to set specified GPIO operation mode.
*/
void GPIO_SetMode(GPIO_T *port, uint32_t u32PinMask, uint32_t u32Mode)
{
    uint32_t i;

    for(i = 0; i < GPIO_PIN_MAX; i++)
    {
        if(u32PinMask & (1 << i))
        {
            port->PMD = (port->PMD & ~(0x3 << (i << 1))) | (u32Mode << (i << 1));
        }
    }
}

/**
* @brief       Enable GPIO interrupt
*
* @param[in]   port            GPIO port. It could be PA, PB, PC, PD, PE or PF.
* @param[in]   u32Pin          The pin of specified GPIO port.
*                              It could be 0 ~ 15 for PA, PB, PC, PD and PE GPIO port.
*                              It could be 0 ~ 3 for PF GPIO port.
* @param[in]   u32IntAttribs   The interrupt attribute of specified GPIO pin. It could be \n
*                              GPIO_INT_RISING, GPIO_INT_FALLING, GPIO_INT_BOTH_EDGE, GPIO_INT_HIGH, GPIO_INT_LOW.
*
* @return      None
*
* @details     This function is used to enable specified GPIO pin interrupt.
*/
void GPIO_EnableInt(GPIO_T *port, uint32_t u32Pin, uint32_t u32IntAttribs)
{
    port->IMD |= (((u32IntAttribs >> 24) & 0xFFUL) << u32Pin);
    port->IEN |= ((u32IntAttribs & 0xFFFFFFUL) << u32Pin);
}


/**
* @brief       Disable GPIO interrupt
*
* @param[in]   port        GPIO port. It could be PA, PB, PC, PD, PE or PF.
* @param[in]   u32Pin      The pin of specified GPIO port.
*                          It could be 0 ~ 15 for PA, PB, PC, PD and PE GPIO port.
*                          It could be 0 ~ 3 for PF GPIO port.
*
* @return      None
*
* @details     This function is used to enable specified GPIO pin interrupt.
*/
void GPIO_DisableInt(GPIO_T *port, uint32_t u32Pin)
{
    port->IMD &= ~(1UL << u32Pin);
    port->IEN &= ~((0x00010001UL) << u32Pin);
}


/*@}*/ /* end of group GPIO_EXPORTED_FUNCTIONS */

/*@}*/ /* end of group GPIO_Driver */

/*@}*/ /* end of group Device_Driver */

/*** (C) COPYRIGHT 2014 Nuvoton Technology Corp. ***/

新版的库函数已经没有这个问题了。

使用特权

评论回复
12
zhuomuniao110| | 2020-4-9 22:30 | 只看该作者
NUC100_120_Series_BSP_CMSIS_V3.00.005.zip (13.42 MB)


使用特权

评论回复
13
zhuomuniao110| | 2020-4-9 22:34 | 只看该作者
楼主用的那个早就被淘汰了

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

36

主题

194

帖子

1

粉丝