ADC采集问题(可参考http://news.eeworld.com.cn/mcu/ic469729.html)

项目场景:

采集电池电压
ADC采集电压,X*3.3/4096


问题描述:

没有配置的参数,会在初始化结构体时分配一个值进去影响寄存器。 ADC_InitStructure.ADC_Resolution = ADC_Resolution_12b; ADC_InitStructure.ADC_ScanConvMode = DISABLE; ADC_InitStructure.ADC_ContinuousConvMode = DISABLE; ADC_InitStructure.ADC_ExternalTrigConvEdge = ADC_ExternalTrigConvEdge_None; ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right; ADC_InitStructure.ADC_NbrOfConversion = 1; // ADC_InitStructure.ADC_ExternalTrigConv = 0; ADC_Init(ADC1, &ADC_InitStructure); ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210313160847484.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0NoZW5femhvdXhpYW4=,size_16,color_FFFFFF,t_70#pic_center)

解决方案:

需要在一开始把结构体的参数初始化一下。否则会影响未赋值的参数,影响写入寄存器的值。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是国内知名的50个嵌入式论坛(按名称首字母排序): 1. ARM中文社区:https://developer.arm.com/cn/community 2. ARM嵌入式开发论坛:https://bbs.21ic.com/forum-64-1.html 3. CSDN嵌入式社区:https://www.csdn.net/nav/embedded 4. eeworld嵌入式网:http://www.eeworld.com.cn/embedded/ 5. 电子发烧友嵌入式论坛:http://bbs.elecfans.com/forum-184-1.html 6. 电子工程师嵌入式开发论坛:https://www.elecfans.com/emb/ 7. 天线宝宝嵌入式论坛:http://bbs.antenk.com/forum-76-1.html 8. 嵌入式ARM论坛:https://www.armbbs.net/forum-46-1.html 9. 嵌入式社区论坛:https://www.embedded.com.cn/forum.php 10. 嵌入式系统开发论坛:http://www.embeddedfans.com/ 11. 嵌入式系统开发网:http://www.embedded.com.cn/ 12. 嵌入式网:http://www.qnr.cn/ 13. 嵌入式学习网:http://www.embedu.org/ 14. 嵌入式英才网:http://www.eetop.cn/ 15. 嵌入式应用开发网:http://www.embeddedstar.com.cn/ 16. 嵌入式之家:http://www.embchina.com/ 17. 嵌入式中国论坛:http://bbs.51mcu.com/ 18. 嵌入式资讯网:http://www.embeddedinfo.com/ 19. 奥松电子嵌入式论坛:http://bbs.ostc-europe.com/ 20. 慧与嵌入式论坛:http://www.embeddedfans.com/ 21. 智能电子网嵌入式论坛:http://bbs.smarter.com.cn/forum-6-1.html 22. 硬件工程师嵌入式论坛:http://bbs.hardware08.com/forum-122-1.html 23. 科技先锋网嵌入式论坛:http://bbs.chinaeda.com/ 24. 联合开发网嵌入式论坛:http://bbs.cnblogs.com/ 25. 隆鑫通讯嵌入式论坛:http://bbs.longxin9.com/ 26. 中国嵌入式技术网:http://www.eetop.cn/ 27. 中国嵌入式网:http://www.embedded.org.cn/ 28. 中国嵌入式学院:http://www.embeddedcollege.org/ 29. 中国嵌入式资讯网:http://www.embeddednews.cn/ 30. 中科院计算技术研究所嵌入式论坛:http://forum.ucas.ac.cn/ 31. 中文开发网嵌入式论坛:http://bbs.csdn.net/home/ 32. 中电电子嵌入式论坛:http://bbs.cechina.cn/forum-130-1.html 33. 中电兴发嵌入式论坛:http://bbs.rayslogic.com/ 34. 中科微嵌入式论坛:http://bbs.casicmicro.com/ 35. 中科院计算所嵌入式论坛:http://forum.ucas.ac.cn/ 36. 中科院自动化所嵌入式论坛:http://forum.ia.cas.cn/ 37. 中软嵌入式论坛:http://bbs.zrtech.cn/ 38. 中微半导体嵌入式论坛:http://www.zwmcu.com/ 39. 中国电子网嵌入式论坛:http://bbs.eccn.com/ 40. 中国电子商情嵌入式论坛:http://bbs.cesinfo.com/ 41. 中国芯片嵌入式论坛:http://www.chinaicmart.com/ 42. 中国芯片设计网嵌入式论坛:http://bbs.chinaeda.com/ 43. 中国芯片网嵌入式论坛:http://bbs.chipfans.com/ 44. 中国自动化网嵌入式论坛:http://bbs.autoeee.com/ 45. 中国自动化网嵌入式论坛:http://www.autoeee.com/ 46. 中国自动化学院嵌入式论坛:http://bbs.caedu.com/ 47. 中芯嵌入式论坛:https://www.zxsilicon.com/forum.php 48. 中航工业嵌入式论坛:http://bbs.avic.com/ 49. 中智电子嵌入式论坛:http://bbs.smart-ele.com/ 50. 中科创达嵌入式论坛:http://bbs.ceacsz.com.cn/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值