你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32W108 ADC多通道问题!!

[复制链接]
question0303 提问时间:2013-7-19 19:49 /
STM32W108单通道如下设置就可以了

void ADCConfiguration(void){
  // 将GPIOA的引脚5定义为模拟输入
  halGpioConfig(PORTA_PIN(5), GPIOCFG_ANALOG);
  
    ADC_CFG = 0;
    ADC_OFFSET = 0;
    ADC_GAIN = 0x8000;
    ADC_DMACFG = ADC_DMARST;
  
    ADC_DMACFG = (ADC_DMAAUTOWRAP | ADC_DMALOAD);
   ADC_DMABEG = (int32u)&adcData;
    ADC_DMASIZE = 1;
 
  // DMA缓冲区满中断使能
  INT_ADCCFG = INT_ADCULDFULL;
  // 清除所有中断标志
  INT_ADCFLAG = 0xFFFF;
  // 使能ADC全局中断
  INT_CFGSET = INT_ADC;
 
  ADC_CFG = (// 采样时间:1024 clocks,有效位:10 bits
               (5
收藏 评论6 发布时间:2013-7-19 19:49

举报

6个回答
zykzyk-93033 回答时间:2013-7-19 21:50:37

RE:STM32W108 ADC多通道问题!!

多看看例程
question0303 回答时间:2013-7-20 08:34:42

回复:STM32W108 ADC多通道问题!!

回复第 2 楼 于2013-07-19 21:50:37发表:
多看看例程 

例程上面没有关于多通道的例子啊。。可否请大神指教下。。谢谢了
question0303 回答时间:2013-7-20 08:36:48

回复:STM32W108 ADC多通道问题!!

请大神们来帮帮忙啊
jumping1967 回答时间:2014-3-24 00:51:52

回复:STM32W108 ADC多通道问题!!

4.  Write the desired offset and gain correction values to the ADC_OFFSETR and
ADC_GAINR registers.
5.  Start the ADC and the DMA.
Write the desired conversion configuration, with the ADC_EN bit set, to ADC_CR.
Clear the ADC buffer full flag – write DMABF to ADC_ISR.
Start the DMA in auto wrap mode – set the AUTOWRAP and LOAD bits in
ADC_DMACR.
6.  Wait until the DMABF bit is set in ADC_ISR, then read the result from analogData.
To convert multiple inputs using this approach, repeat Steps 4 through 6, loading the desired
input configurations to ADC_CR in Step 5. If the inputs can use the same offset/gain
correction, just repeat Steps 5 and 6.
jumping1967 回答时间:2014-3-24 00:59:02

回复:STM32W108 ADC多通道问题!!

在这里,第5步是关键,就是设置ADC_CR的CHSELP[3:0]及CHSELN[3:0]位,它告诉了你要设置的通道号,如ADC1或ADC2等。设置好通道号后,等待DMABF位置位,就可以读到不同通道的ADC值。之后重复第5步,第6步完成不同通道的读取。
Adrain_shine 回答时间:2014-3-27 11:12:06

回复:STM32W108 ADC多通道问题!!

STM32W108,怎么去读GPIO_PXIN返回引脚的输入值
button3state=1;
if(button3state!=((GPIO_PCIN&ampC0_MASK)>&gtC1_BIT))//PC1l连接一按键
      {
        beepload();
        button3state=((GPIO_PCIN&ampC0_MASK)>&gtC1_BIT);
      }
此程序貌似是直接读取按键的PCIN的输入值,而不用中断
实验现象应该是按键按下,蜂鸣器响
释放按键,蜂鸣器不响
但是实际却并未成功,就是不明白如何去读取GPIO_PCIN的返回引脚输入值
求大神赐教!!!!!!!!!!!!!!!!!!!!!!!!!!
大神貌似也在学习STM32W108,我最近也在学习,在某些问题上我们可以相互探讨qq:320959100
关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版