TI中文支持网
TI专业的中文技术问题搜集分享网站

ADCSequenceStepConfigure()函数修改问题

,用的芯片型号是TM4C129XNCZAD。ADCSequenceStepConfigure(ADC0_BASE,  0, 0, ADC_CTL_CH0 | ADC_CTL_IE);为什么只能输出ADC_CTL_CH0到ADC_CTL_CH7,ADC_CTL_CH8到ADC_CTL_CH23无数值输出,查看资料,发现以前的LM3S9B96芯片只能初始化到ADC_CTL_CH7,是不是由于ADCSequenceStepConfigure()函数未更新造成的,如果是,怎么在底层修改ADCSequenceStepConfigure()函数。

ADCSequenceStepConfigure()函数如下所示:

#define ADC_SEQ (ADC_O_SSMUX0)
#define ADC_SEQ_STEP (ADC_O_SSMUX1 – ADC_O_SSMUX0)
#define ADC_SSMUX (ADC_O_SSMUX0 – ADC_O_SSMUX0)
#define ADC_SSEMUX (ADC_O_SSEMUX0 – ADC_O_SSMUX0)
#define ADC_SSCTL (ADC_O_SSCTL0 – ADC_O_SSMUX0)
#define ADC_SSFIFO (ADC_O_SSFIFO0 – ADC_O_SSMUX0)
#define ADC_SSFSTAT (ADC_O_SSFSTAT0 – ADC_O_SSMUX0)
#define ADC_SSOP (ADC_O_SSOP0 – ADC_O_SSMUX0)
#define ADC_SSDC (ADC_O_SSDC0 – ADC_O_SSMUX0)
void
ADCSequenceStepConfigure(uint32_t ui32Base,uint32_t ui32SequenceNum
                         uint32_t ui32Step,uint32_t ui32Config)
{
 uint32_t ui32Temp;
 ASSERT((uint32_t ui32Base == ADC0_BASE)||(uint32_t ui32Base == ADC1_BASE)); 
 ASSERT(ui32SequenceNum<4);
 ASSERT(((ui32SequenceNum == 0) && (ui32Step < 8))||
        ((ui32SequenceNum == 1) && (ui32Step < 4))||
        ((ui32SequenceNum == 2) && (ui32Step < 4))||
        ((ui32SequenceNum == 3) && (ui32Step < 1)));
   
 ui32Base +=ADC_SEQ + (ADC_SEQ_STEP * ui32SequenceNum);
 ui32Step *= 4;
 HWREG(ui32Base + ADC_SSMUX) = ((HWREG(ui32Base + ADC_SSMUX) &     ~(0x0000000f << ui32Step)) |
     ((ui32Config & 0x0f) << ui32Step);
 HWREG(ui32Base + ADC_SSEMUX) = (HWREG(ui32Base + ADC_SSeMUX) &     ~(0x0000000f << ui32Step)) |
     (((ui32Config & 0xf00) >>8) << ui32Step);
 HWREG(ui32Base + ADC_SSCTL) = ((HWREG(ui32Base + ADC_SSCTL) &     ~(0x0000000f << ui32Step)) |
     (((ui32Config & 0xf0) >>4) << ui32Step);
 if(ui32Config & 0x000F0000)
 {
  ui32Temp = HWREG(ui32Base + ADC_SSDC);
  ui32Temp &= ~(0xF << ui32Step); 
  ui32Temp |= (((ui32Config & 0x00070000) >> 16) << ui32Step);
  HWREG(ui32Base + ADC_SSDC) = ui32Temp;
  HWREG(ui32Base + ADC_SSOP) |= (1 << ui32Step);
 }
 else
  HWREG(ui32Base + ADC_SSOP) &= ~(1 << ui32Step); 

}

xyz549040622:

没听说ADCSequenceStepConfigure()有这个BUG呀

1.可以用ROM_ADCSequenceStepConfigure()试试

2.查看寄存器,看ADC_CTL_CH8到ADC_CTL_CH23初始化了没有

3.怀疑是你的芯片的TM4C129XNCZAD宏定义选择了没,因此造成了他的部分ADC没有初始化

赞(0)
未经允许不得转载:TI中文支持网 » ADCSequenceStepConfigure()函数修改问题
分享到: 更多 (0)