完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,
在复位后第一次运行期间进行ADC1单次扫描转换(ADC0至ADC2通道)时,ADC2始终为0(ADC1和0均为正常)。接下来和接下来的几组读数都可以。它在STM8S Discovery(STM8S105C6)上进行测试。码: “” ADC_Config(); ADC1_StartConversion(); while(ADC1_GetFlagStatus(ADC1_FLAG_EOC)!= RESET) ; HS_buffer [0] = ADC1_GetBufferValue(2); SU_buffer [0] = ADC1_GetBufferValue(1); U_steu = ADC1_GetBufferValue(0); ADC1_DeInit(); “” 其中ADC_config(): “” ADC1_DeInit(); / * De-Init ADC外设* / / * Init ADC2外设* / ADC1_ScanModeCmd(ENABLE); ADC1_Init(ADC1_CONVERSIONMODE_SINGLE,ADC1_CHANNEL_2,ADC1_PRESSEL_FCPU_D2, ADC1_EXTTRIG_tiM,DISABLE,ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL0 | ADC1_SCHMITTTRIG_CHANNEL1 | ADC1_SCHMITTTRIG_CHANNEL2, DISABLE); “” 当我(在有问题的第一次运行期间)设置断点时 ''HS_buffer [0] = ADC1_GetBufferValue(2);''并执行步骤 - 结果正常。 我在重置后通过虚拟读取来解决它,但我想知道原因。 谢谢。 #stm8#adc1#single-scan 以上来自于谷歌翻译 以下为原文 Hello everybody, when doing ADC1 single scan conversion (ADC0 to ADC2 channels) during the first run after reset the ADC2 is always 0 (ADC1 and 0 are OK). The next and following sets of readings are then all OK. It is tested on STM8S Discovery (STM8S105C6). Code: '' ADC_Config(); ADC1_StartConversion(); while( ADC1_GetFlagStatus(ADC1_FLAG_EOC) != RESET) ; HS_buffer[0] = ADC1_GetBufferValue(2); SU_buffer[0] = ADC1_GetBufferValue(1); U_steu = ADC1_GetBufferValue(0); ADC1_DeInit(); '' where ADC_config(): '' ADC1_DeInit();/* De-Init ADC peripheral*/ /* Init ADC2 peripheral */ ADC1_ScanModeCmd(ENABLE); ADC1_Init(ADC1_CONVERSIONMODE_SINGLE, ADC1_CHANNEL_2, ADC1_PRESSEL_FCPU_D2, ADC1_EXTTRIG_TIM, DISABLE, ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL0 | ADC1_SCHMITTTRIG_CHANNEL1 | ADC1_SCHMITTTRIG_CHANNEL2, DISABLE); '' When I (during the problematic first run) set breakpoint on the ''HS_buffer[0] = ADC1_GetBufferValue(2);'' and do step- the result is OK. I solve it by dummy reading after reset, but I would like to know the reason. Thank You. #stm8 #adc1 #single-scan |
|
相关推荐
3个回答
|
|
当然,
应该有''== RESET''。现在它工作正常。有谁知道,如何删除线程?我认为这不是真的有用:-)。 以上来自于谷歌翻译 以下为原文 Of course, there should be '' == RESET''. Now it works fine. Does anybody know, how to delete the thread? I think it is not really helpful :-). |
|
|
|
|
|
|
|
这是一个3岁的帖子,论坛可能不会提醒,因为它在一年前被转移到了另一个平台。
以上来自于谷歌翻译 以下为原文 This is a 3-year old thread, forum may not alert since it was moved to a different platform a year ago. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2648 浏览 1 评论
3213 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1787 浏览 1 评论
3616 浏览 6 评论
5996 浏览 21 评论
944浏览 4评论
1318浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
588浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1307浏览 3评论
1367浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 12:55 , Processed in 1.266708 second(s), Total 81, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号