This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/MSP430G2553:MSP430x2xx 和 LaunchPad 上的内部上拉电阻器

Guru**** 2551110 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/869448/ccs-msp430g2553-internal-pull-up-resistors-on-msp430x2xx-and-launchpad

器件型号:MSP430G2553

工具/软件:Code Composer Studio

我已经为引脚1.6和1.7使用了值为10K 的外部上拉电阻器

但是、当我执行以下检查时

#define DIP1 BIT7

void main (void)
{
unsigned char j = 0;
P1DIR = 0x00;

if (P1IN & DIP1 = DIP1)
{
j = 1;
}
否则
{
j = 0;
}

我永远不会得到 IF 环路中的条件为 true。 为什么会这样呢? 我缺少什么吗?

提前感谢。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    >  if(P1IN & DIP1 == DIP1)

    C operator precedence. Try:

    >  if((P1IN & DIP1) == DIP1)