完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
我尝试在我的Explorer 16板上用PIC24FJ128GA310插件来执行ADC。我使用MPLAB X 3.30和代码配置器。我的目标是通过UART在屏幕上看到adc值。通过使用Code Configurator,我选择了引脚20(浏览器16板中的AN5-POT)和引脚25(AN0-adc的任何引脚)。此外,我使用UART1(PN49作为RX&PAN50作为TX)。然后,我在main.c中生成代码&如下:int main(void){int转换;SYSTEM_Initialize();ADC1_ChannelSelect(ADC1_POT);.(1){ADC1_Start();//Provide Delay ADC1_Stop();.()!ADC1_IsConversionComplete()){ADC1_Tasks();}convertion=ADC1_ConversionResultGet();printf("Pot_value=%dnr",convertion);//Add您的应用程序代码//Add您的应用程序代码}.-1;}当我为adc选择POT(AN5)pin时,输出正好在第四位。船上电位器值的变化。但是,当我把ADC管脚换成AN0之类的其他管脚时,显示的输出接近3V。而且我用万用表检查了该管脚上面的万用表,它显示0.7V浮动。我需要一些建议在任何模拟输入管脚上运行adc。我需要改变一些硬件或软件的改变是否有效。
以上来自于百度翻译 以下为原文 I am trying to perform ADC on my explorer 16 board with PIC24FJ128GA310 plug in module. I am using MPLAB X 3.30 & code configurator. My aim is to see the adc value on the screen via UART. By using Code Configurator, I selected pin 20 (AN5-POT in explorer 16 board) & pin 25 (AN0- any pin for adc). Also I used UART1 (with pin49 as RX & pin50 as TX). Then i generated the code & in the main.c, i have done below: int main(void) { int conversion; SYSTEM_Initialize(); ADC1_ChannelSelect(ADC1_POT); while (1) { ADC1_Start(); //Provide Delay ADC1_Stop(); while(!ADC1_IsConversionComplete()) { ADC1_Tasks(); } conversion = ADC1_ConversionResultGet(); printf("Pot_value=%dnr",conversion);// Add your application code // Add your application code } return -1; } When i am selecting POT(AN5) pin for adc, the output is coming exact the variation in on board potentiometer value. But when i am changing ADC pin to any other like AN0, the displayed output is near to 3 V. Also i checked by putting the multimeter over that pin & it was showing 0.7 V floating. I need some suggestion to run adc on any analog input pin. Do i need to change some hardware or software changes will work. Regards NitS |
|
相关推荐
8个回答
|
|
您是否偶然测量浮动值(即未连接的PIN)?
以上来自于百度翻译 以下为原文 Are you by chance measuring on a floating value (that is a not-connected pin)? |
|
|
|
我赞成达里奥的建议。为了确保代码正确地驱动ADC,最好把它连接到一个稳定的已知电压基准上。
以上来自于百度翻译 以下为原文 I second Dario's suggestion. In order to make sure your code is driving the ADC properly you'd better connect it to a stable known voltage reference. |
|
|
|
如果你的电压变化缓慢,也就是说它是直流的,我推荐一个0.1NF的上限,它无论如何都有帮助。当然,如果你测量交流或高频,那么你就不能。串联电阻更像是一种安全措施,我基本上从来不使用它。
以上来自于百度翻译 以下为原文 IF your voltage changes slowly, i.e. it's DC, I recommend a 0.1nF cap - it helps anyway. Of course, if you're measuring AC or high frequencies, then you can't. The series resistor is more like a safety measure, and I basically never use it. |
|
|
|
如果每毫秒改变一次,就相当于1千赫。这是相对低的频率。用一个1k电阻和100nF电容组成的RC滤波器对你的信号影响可以忽略不计。
以上来自于百度翻译 以下为原文 If it changes once per millisecond, that's similar to one kilohertz. That is a relatively LOW frequency. An RC filter made with a 1k resistor and a 100nF capacitor will have negligible effect on your signal. |
|
|
|
非常感谢各位论坛成员。
以上来自于百度翻译 以下为原文 Thanks a lot Forum MemberS. A nice place to get cool & actual ideaS. ResPecT |
|
|
|
你只给我们暗示你做了什么,你用了什么样的电阻值作为分压器?分配器有接地电容器吗?一个完整的电路板将是有益的。
以上来自于百度翻译 以下为原文 You are only giving us hints about what you have done. What actual resistor values did you use for your voltage divider? Do you have a capacitor to ground connected after the divider? A full schematic of your board would be useful. |
|
|
|
亲爱的大家,对于这个延迟,我使用了一个分压器,分压为10V到3.3V,比例为R1=1Mohms&R2=500kohms。当我使用这个电阻值时,同样的问题还在继续,但是我把电阻值改为47k(R1)&23k(R2),令人惊讶的是这个问题解决了。但我的ADC仍然没有给出适当的稳定值。在每秒5次采样中,我得到一个误差值。善意地建议。我想把一个很小的电容值的滤波器电路放进去。
以上来自于百度翻译 以下为原文 Dear all, Sry for this delay I am using a voltage divider for 10 V to 3.3 V scaling with R1 = 1 Mohms & R2 = 500 kohms. When i am using this value of resistor, same problem is continuing but i change the resistor value to 47 k (R1) & 23 k(R2), surprisingly this issue is solved. But still my ADC is not giving proper stable values. I am getting one error value out of 5 times of sampling at every second. Kindly suggests. I am thinking to put a filer circuit of R & very small value of capacitor. Regards NiTs |
|
|
|
一点也不奇怪。你的初始值太大了。如上所述,你必须注意ADC输入端的最大允许阻抗。只要加一个电容器,你的分压器已经提供R。从100nF开始,看看它是如何工作的。
以上来自于百度翻译 以下为原文 Not surprising at all. Your initial value were way too big. As mentioned above, you must pay attention to the maximum permitted impedance into the ADC input. Just add a capacitor, your divider is already providing the R. Start with 100nF and see how that works. |
|
|
|
只有小组成员才能发言,加入小组>>
5125 浏览 9 评论
1984 浏览 8 评论
1914 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3148 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2212 浏览 5 评论
693浏览 1评论
579浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
461浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
598浏览 0评论
493浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-1 02:05 , Processed in 1.190020 second(s), Total 90, Slave 74 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号