已回答假定已回答

AD7327始终只输出CH0的AD值

84083000@qq.com 在 2018-6-9 詢問的問題

我按照官网的程序来写,在main函数里初始化。

AD7327_Pin_Configuration();
WriteToRangeRegister1 (IN10vCH0, IN10vCH1, IN10vCH2, IN10vCH3);
WriteToRangeRegister2 (IN10vCH4, IN10vCH5, IN10vCH6, IN10vCH7);

之后,在while(1)循环里调用dout = ADC_Read(CH1),发现,无论我是读CH1还是其它AD通道,始终只输出CH0通道的AD值,请问我这问题出在哪?

u16 ADC_Read(u16 ch)

{

  u16 ReturnData = 0x0000;

  switch(ch)

  {

  case CH0:

  ReturnData = WriteToSequenceRegister (VIN0);

  ReturnData = WriteToControlRegister(CH0, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  ReturnData = ReadSequence();

  break;

  case CH1:

  ReturnData = WriteToSequenceRegister (VIN1);

  delay_us(1000);

  ReturnData = WriteToControlRegister(CH1, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  delay_us(1000);

  ReturnData = ReadSequence();

  delay_us(10);

  break;

  case CH2:

  ReturnData = WriteToSequenceRegister (VIN2);

  ReturnData = WriteToControlRegister(CH2, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  break;

  case CH3:

  ReturnData = WriteToSequenceRegister (VIN3);

  ReturnData = WriteToControlRegister(CH3, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  break;

  case CH4:

  ReturnData = WriteToSequenceRegister (VIN4);

  ReturnData = WriteToControlRegister(CH4, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  break;

  case CH5:

  ReturnData = WriteToSequenceRegister (VIN5);

  ReturnData = WriteToControlRegister(CH5, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  break;

  case CH6:

  ReturnData = WriteToSequenceRegister (VIN6);

  ReturnData = WriteToControlRegister(CH6, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  break;

  case CH7:

  ReturnData = WriteToSequenceRegister (VIN7);

  ReturnData = WriteToControlRegister(CH7, Mode0, Normal, StraightBinary, Ref_En, SequencerOff);

  break;

  default:

  break;

  }

  return ReturnData;

 

}

結果