Microchip
直播中

陈忠阳

7年用户 165经验值
私信 关注
[问答]

PIC18F46J50引脚RB1和RB2上的意外行为

我的板应该使用引脚RB1和RB2,每个读取按钮按下。为此,我通过一个100K电阻将每个引脚连接到3V3电源线。这两个按钮然后“接地”在电阻器和PIC引脚之间的相应馈电。课本上的东西。我发现插脚总是按压读。一个多表检查显示,每个引脚上的电压大约是1V65,而不是我预期的3V3。在100K电阻之前,万用表读取一个稳定的3V3,所以很明显有东西在拉低电压。最后,作为最小功能测试,我只配置了数字、输出和高电平的引脚。为此,我绝对期望在引脚上看到3V3,但它仍然是1V65。如果情况可能不同的话,我使用PIC18LF46J50。还有一些额外的配置我忽略了吗?谢谢。

以上来自于百度翻译


      以下为原文

    My board is supposed to use pins RB1 and RB2 to each read a button press. For this I have each pin tied to the 3V3 power line via a 100K resistor. The two buttons then "ground" the corresponding feed between the resistor and the PIC pin. Textbook stuff.

I found that the pins are always reading as pressed. A multi-meter check reveals that the voltage on each pin is around 1V65 rather than the 3V3 that I was expecting. The multi-meter reads a steady 3V3 BEFORE the 100K resistor, so clearly something is pulling the voltage down.

Finally, as a minimum function test I merely configured the pins for digital, output and high. For this I would definitely expect to see 3V3 on the pins, but it is still 1V65.

Just in case it might make a difference I am using the PIC18LF46J50 .

Is there some additional configuration that I have overlooked?

Thanks.

    ANCON1bits.PCFG8 = 1; /* Set RB2/AN8 for digital not analogue */
    ANCON1bits.PCFG10 = 1; /* Set RB1/AN10 for digital not analogue */
   
    INTCON2bits.RBPU = 1; /* Disable pull-up resistors just in case */
   
    TRISBbits.TRISB2 = 0; /* Set pins for output */
    TRISBbits.TRISB1 = 0;
   
    LATBbits.LATB2 = 1; /* Set pin output = high */
    LATBbits.LATB1 = 1;
   
    /* Now I would expect to see 3V3 on the pins but something
     * is dragging down the voltage */


回帖(4)

吴键洪

2018-9-10 15:43:08
请发布你的整个最小程序。所有的,包括,配置,工作。输出半电压的声音,像一个快速复位的设备。

以上来自于百度翻译


      以下为原文

    Please post your ENTIRE minimal program.
Everything, #includes, config settings, the works.
 
Outputting half voltage sounds like a device that is resetting rapidly.
 
举报

孙燕冉

2018-9-10 15:49:35
建议:去掉你的电阻。使用内部拉柱。(不输出)

以上来自于百度翻译


      以下为原文

    Suggest:
Ditch your resistors.
Use the internal pullups.
Set the pins for INPUT! (not output)
举报

tijing忽忽

2018-9-10 16:06:31
如果如上所述,当设置高电平时,OP不能获得接近VDD电平的输出(读取1.6 V而不是接近3.3 V的东西),那么设置输入模式的引脚实际上将不会有太大的帮助,有些东西是错误的,非常错误。张贴整个测试程序代码和可能的示意图将是下一步要采取的措施。

以上来自于百度翻译


      以下为原文

   
If as stated the OP cannot get the outputs to read close to the Vdd level when set high (reading 1.6 v instead of something close to 3.3 v) then setting the pins for input mode is really not going to be of much help, something else is wrong, very wrong. Posting the entire test program code and maybe a schematic would be the next step to take.
举报

张蕾

2018-9-10 16:15:21
常闭按钮?

以上来自于百度翻译


      以下为原文

    Normally Closed buttons?
举报

更多回帖

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