完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好!这是我的第一个线程,所以请为任何类型的错误道歉,如我的情况不好,因为我的英语不好。所以我的问题是,有没有一种方法可以检测一个人是否通过软件连接了电位器?我正在开发一个板,有8个电位器连接,并不总是将它们连接起来,如果其中一个没有连接,我不想显示浮动值,对于这种情况,我想把这个值锁定为0。我想要一些即插即用,如果有人连接电位计而不重置板,它会开始读取和显示值。有人能帮助我吗?我试着把针脚放高,然后做一个ADC读,然后把它放低,再读一遍,我知道如果不是电位器连接,我会读到像1020和3一样的东西,如果有一个连接,我会读出不同的值,但是如果有人让电位器,我就害怕烧掉我的芯片。在低位或高位,还是不会发生这种情况?不幸的是,我只能做软件更改,硬件更改不再是可用的,因为我的板卡已经制造好了。谢谢大家!
以上来自于百度翻译 以下为原文 Hello guys! This is my first thread, so please sorry for any kind of mistake, such in bad explication of my situation as for my bad english. So here is my question, is there a way I can detect if a person did connected a potentiometer or not by software? I'm developing a board that have 8 potentiometer connections, and not always will they all be connected, and if one of them is not connected I don't wanna floating values displaying, for this situation I wanna lock the value to 0. And I wanna some kind of plug and play, if someone connect a potentiometer without reset the board, it would start read and displaying the values. Can someone help me? I tried to put the pin high and do a ADC read, and then put it low and read again, I know if ther is not a potentiometer connected I will read something like 1020 and 3, and if is there one connected I will read diferent values, but I have a fear to burn my chip if the person let the potentiometer in the low or high position, or this won't happen? Unfortunately, I can do only software change, hardware changes is no longer avaliable because my boards is already manufactured. Thanks all you guys! |
|
相关推荐
5个回答
|
|
连接外部1M下拉。然后做两个测试:1。禁用内部上拉。如果未连接,PotoRead将读取为零。2。启用内部上拉。如果没有连接,端口将读为一个。如果连接了什么,两个都将读取相同的信息。可能是一个坏的情况下,罐连接,但设置到中间。或者,你可以用ADC测量。
以上来自于百度翻译 以下为原文 Connect external 1M pull-down. Then do two tests: 1. Disable internal pull-up. PORT will read as zero if unconnected. 2. Enable internal pull-up. PORT will read as one if unconnected. If something is connected, both will read the same. Potentially a bad case when the pot is connected, but set right to the middle. Or, you can measure with ADC. |
|
|
|
嗨,诺斯盖伊!谢谢你的回答!但是正如我所说,硬件修改不再是可使用的,所以外部下拉不是一个可能的解决方案。而负责ADC读取的波尔塔,在这个PIC上没有内部上拉电阻。
以上来自于百度翻译 以下为原文 Hi NorthGuy! Thank you for your answer! But as I told, hardware modifications are no longer avaliable, so the external pull-down is not a possible soluction. And the PORTA, responsible for the ADC reads, don't have internal pull-up resistor on this PIC. |
|
|
|
做得很快,关于出去/高出/低的事情将毫无问题地工作。
以上来自于百度翻译 以下为原文 Done quickly, that thing about going out/high and out/low will work without issues... |
|
|
|
在很短的时间内驱动高/低可能是好的-如果你只测量信号,你只需要两个周期就能得到好的读数。很难预测你看到了什么。你可能会得到一些波动,或者你可以看到它是死的0,或者1。不能可靠地检测。最好是有一个更现代化的图片,每一个引脚上拉和拉。
以上来自于百度翻译 以下为原文 Driving the high/low for very short time might be Ok - you only need two cycles to get a digital read. If you only measure the signal. it's hard to predict what you see. You may get some fluctuations, or you may see it as dead 0, or 1. Cannot detect reliably. Would be better to have a more modern PIC with pull-ups and pull-downs on every pin. |
|
|
|
理想情况下,从POTS的模拟输入将有一个电容器GND,因此,如果你启用弱上拉,电压将逐渐上升到VDD。如果电位器被连接,电压只会随上拉而变化(除非罐处于最大值)。您还可以安全地设置引脚作为数字输出,并将其拉到GND短暂放电电容器。如果没有电容器,内部采样电容器可能足以保持高电压电平或低电压电平足够长以看到连续读数之间的变化。
以上来自于百度翻译 以下为原文 Ideally the analog inputs from the pots will have a capacitor to GND, so if you enable the weak pull-up, the voltage will gradually rise to Vdd. If a potentiometer is connected, the voltage will change only a little with the pull-up (unless the pot is at maximum). You can also safely set the pin as digital output and pull it to GND briefly to discharge the capacitor. If no capacitor is present, the internal sampling capacitor may be enough to hold the high or low voltage level long enough to see a variation between successive readings. |
|
|
|
只有小组成员才能发言,加入小组>>
5163 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3174 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
733浏览 1评论
615浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
505浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
631浏览 0评论
528浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 03:16 , Processed in 1.186535 second(s), Total 87, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号