我可以从图 18f4550 的 PORTBbits.RB7 中获取哪个值
我可以从 PORTBbits.RB7 得到哪个值,在这个端口上有一个连接了电阻的绿色 LED(见图)。我使用 pic F184550 和 mplab ide v8.63 以及来自 mplab microchip 的 C 编译器 C18。或者我是否需要写信给腻子才能看到这个值。谢谢
Which value can I expect from PORTBbits.RB7, on this port there is a green led with a resistor connected (see picture). I'm using pic F184550 with mplab ide v8.63 and a C compiler C18 from mplab microchip. Or do I need to write to putty to see this value. thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的答案取决于 PORTB7 引脚上测量的电压,答案将为 0、1 或两者。
其原因在于数字 GPIO 引脚的工作方式。为了确定该引脚上的给定电压会产生 0 还是 1,芯片制造商设置了一个阈值。对于 PIC18:
因此,如果 Vdd == 3.3V,则 PORTB7 两端的电压需要为 2.64V 或以上才能读取为数字 ' 1'。 0 - 0.66V 的电压将被读取为数字“0”。
如果电压介于这两个阈值之间怎么办?谁知道?您只知道您有两个选择:0 或 1。
现在,如果您想读取 PORTB7 的实际电压电平,那么不幸的是您运气不好。您需要将该电压电平连接到 ADC 才能获取该信息。
The short answer would be depending on the voltage that is measured on the PORTB7 pin, the answer will be a 0, 1, or both.
The reason for that is because of the way a digital GPIO pin works. To determine whether a given voltage across that pin results in a 0 or a 1, a threshold is set by the chip manufacturer. For the PIC18:
So if Vdd == 3.3V, the voltage across PORTB7 needs to be 2.64V or above to be read as a digital '1'. A voltage of 0 - 0.66V will be read as a digital '0'.
What if the voltage is somewhere in between those two thresholds? Who knows? All you know is that you have two choices: 0 or 1.
Now if you're looking to read the actual voltage level off of PORTB7 then unfortunatley you're out of luck. You'll need to connect that voltage level to an ADC to be able to get that information.