Microchip
直播中

陈涛

8年用户 217经验值
私信 关注
[问答]

dsPIC33FJ128GP706A在PROGRAM MODE中不读取数字IO引脚

我正在使用一个DSPIC33 FJ128GP706A。我正在尝试检测一个连接到引脚17(RB6/AN6)的开关。我已将其连接在以下配置中:+3.3V->100欧姆->Switch->使用10K下拉电阻器连接到引脚和地面。以下是用于读取压力然后释放开关的代码:.(!{B} { }同时(PurbButs.RB6){},当我处于调试模式时,这是完美的。然而,当我对PIC进行编程时,处理器从来没有检测到按下按钮,随后的代码执行也没有发生。

以上来自于百度翻译


      以下为原文

    I am working with a dsPIC33FJ128GP706A.
I am trying to detect a switch that is connected to Pin 17 (RB6/AN6). I have it connected in the following configuration:
+3.3V -> 100 ohm -> Switch -> connect to pin and ground using a 10K pull down resistor.

Here is the code used to read the press and then release of the switch:
while( !PORTBbits.RB6)
{
}
while(PORTBbits.RB6)
{
}

This works perfectly when I am in debug mode. However, when I program the PIC, the processor never detects the button press and subsequent code execution does not occur.

I have set configured the Digital I/O correctly and also verified the ADPCFG bit associated with it.
   Attached Image(s)

回帖(7)

王焕树

2019-6-19 07:02:09
你确定吗?如果你真的想得到帮助,最好把你的实际代码展示给一双新的眼睛看。

以上来自于百度翻译


      以下为原文

   
Are you sure?
If you really want help with this, it would be better to show your actual code for a fresh pair of eyes to see.
 
举报

薄坤坤

2019-6-19 07:08:30
虽然它看起来工作得很完美,但我想它可能正在做“奇怪”的事情,但是到目前为止你还是看不到。你需要去掉开关——仅仅读端口是不够的。苏珊

以上来自于百度翻译


      以下为原文

    While it mighty look as though it is working perfectly, I think it might be doing 'strange' things but so far you cannot see them.
You need to debounce the switch - simply reading the port is not enough.
Susan
举报

王璨

2019-6-19 07:24:29
ALL:开关被一个10英寸KS@ SRIDHAR的盖帽弹出:你检查电源了吗?DSPIC是否运行?

以上来自于百度翻译


      以下为原文

    @all: the switch is debounced by a cap ║ the 10 k.
@Sridhar: did you check the supply? Does the dsPIC run at all?
举报

康辅佑

2019-6-19 07:35:53
由于GP706(A)有两个片上ADCs,所以必须根据您的需要配置AD1PCFG和AD2PCFG。

以上来自于百度翻译


      以下为原文

    Since the GP706(A) have two on-chip ADCs, you must configure both AD1PCFG and AD2PCFG according to you needs.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分