[求助] LM3S9B95 ADC没法采样

zw357234798   2011-7-24 18:35 楼主

下面是初始化程序 SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
  GPIOPinTypeGPIOInput(GPIO_PORTD_BASE,0XFF);
  SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC);
  ADCReferenceSet(ADC_BASE,ADC_REF_INT);
  SysCtlADCSpeedSet(SYSCTL_ADCSPEED_250KSPS); 
 
  ADCSequenceDisable(ADC_BASE,1);           
  ADCSequenceConfigure(ADC_BASE,1,   ADC_TRIGGER_PROCESSOR,0);
  ADCSequenceStepConfigure(ADC_BASE, 1, 0, ADC_CTL_CH12);
  ADCSequenceStepConfigure(ADC_BASE, 1, 1, ADC_CTL_CH13);
  ADCSequenceStepConfigure(ADC_BASE, 1, 2, ADC_CTL_CH14
                                           |ADC_CTL_END
                                           | ADC_CTL_IE);
                                                                                                                                                
  ADCIntEnable(ADC_BASE, 1);
  IntEnable(INT_ADC1);
  IntMasterEnable();
  ADCSequenceEnable(ADC_BASE,1);

unsigned int  ADC_Sample()
{
   unsigned int daLR,daLM,daMR,i;//三个传感器电压差值
  ADCProcessorTrigger(ADC_BASE, 1);
  while (!Flag);
  Flag = 0;    
  ADCSequenceDataGet(ADC_BASE, 1, Value);
  for (i = 0;    i < 3;    i++)
        {
         Value = (Value * 3000) / 1024;       //   转换成电压值
        }
      daLR=abs(Value[0]-Value[2]);
      daLM=abs(Value[0]-Value[1]);
      daMR=abs(Value[1]-Value[2]);
     return( find_min(daLR,daLM,daMR));
}
采样的结果不管怎样全是0.是不是9B95又有什么特殊配置啊

回复评论 (1)

for (i = 0;    i < 3;    i++)
        {
         Value = (Value * 3000) / 1024;       //   转换成电压值
        }
这样可以吗
点赞  2011-7-25 08:54
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复