我正在使用一个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 configura
tion:
+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)