已回答假定已回答

AD7190校准问题请教

呵呵大 在 2017-7-25 詢問的問題
最後回覆由Vincent CHEN於2017-9-13提供

因为code跳动的比较大,所以我用校准功能,看能否解决问题,在使用校准问题中遇到一些问题,请大家帮忙解答!

 

1       校准有内部校准和系统校准两种,那么应该在什么情况下使用内部校准什么情况下使用系统校准?

2       PDF文档的描述中中只有失调寄存器和满量程寄存器两个,上面说的两种校准模式是共用这两个寄存器吗?如果是这样的话,当我进行内部校准之后再进行系统校准,那么内部校准的的数据不是别覆盖了吗?

3     Data = [(0.75 × VIN × Gain/VREF) × (223) – (Offset_Reg – 0x800000)] ×Full_Scale_Reg/0x400000 × 2这个公式里面的Offset_Reg和Full_Scale_Reg是内部校准系数还说系统校准系数?

4     我进行内部校准时,为什么校准过后,失调寄存器一直是0xffffff,满量程寄存器一直都是0x553a50(好像是出厂值)

贴出AD7190的代码

 

 

void Init_ad7190()

  {

  ClrCs;

  buf[0] = 0xff;

  WriteToAD7190(1,buf);

  WriteToAD7190(1,buf);

  WriteToAD7190(1,buf);

  WriteToAD7190(1,buf);

  WriteToAD7190(1,buf);

  delay(1000); //¸´Î»AD7190

 

  buf[0] = 0x10;

  WriteToAD7190(1,buf); 

  buf[2] = 0x00;

  buf[1] = 0x02;

  buf[0] = 0x58;

  WriteToAD7190(3,buf);

 

 

 

  buf[0] = 0x08; //д0x08µ½Í¨ÐżĴæÆ÷ ÅäÖá®Ä£Ê½¼Ä´æÆ÷¡¯

  WriteToAD7190(1,buf);

  buf[2] = 0x80;

  buf[1] = 0x00;

  buf[0] = 0x60;

  WriteToAD7190(3,buf);

  delay(100);

  while((GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_2))==1);//µÈ´ýÄÚ²¿ÁãµçƽУ׼Íê³É

 

 

  buf[0] = 0x08; //д0x08µ½Í¨ÐżĴæÆ÷ ÅäÖá®Ä£Ê½¼Ä´æÆ÷¡¯

  WriteToAD7190(1,buf);

  buf[2] = 0xA0; //ÄÚ²¿ÂúÁ¿³ÌУ׼£¬×´Ì¬¼Ä´æÆ÷²»·¢ËÍ£¬Íⲿ4.9152M¾§Õñ

  buf[1] = 0x00; //sinc4Â˲¨Æ÷£¬½ûÖ¹ÆæżУ׼£¬REJ60=1£¬¸üºÃµÄ50HzÒÖÖÆ£¬Êä³öËÙÂÊ=50Hz

  buf[0] = 0x60; //ÄÚ²¿ÂúÁ¿³ÌУ׼Ôڽϵ͵ÄËÙÂÊÏ¿ÉÒÔ»ñµÃ½Ï¸ßµÄ¾«¶È

  WriteToAD7190(3,buf);

  delay(100);

  while((GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_2))==1); //µÈ´ýÄÚ²¿ÂúÁ¿³ÌУ׼Íê³É

 

 

  buf[0] = 0x74; //д0x74µ½Í¨ÐżĴæÆ÷ ¶ÁÈ¡¡®Ê§µ÷¼Ä´æÆ÷¡¯0111 0100

  WriteToAD7190(1,buf);

  while((GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_2))==0); //µÈ´ýÄÚ²¿ÁãµçƽУ׼Íê³É

  {

  ReadFromAD7190(4,buf); //¶ÁÊý¾Ý¼Ä´æÆ÷

  InterZeroAdjustData=(u32)buf[3]<<16;

  InterZeroAdjustData|=(u16)buf[2]<<8;

  InterZeroAdjustData|=buf[1];

  }

 

 

  buf[0] = 0x7C; //д0x7cµ½Í¨ÐżĴæÆ÷ ¶ÁÈ¡¡®ÂúÁ¿³Ì¼Ä´æÆ÷¡¯0111 1100

  WriteToAD7190(1,buf);

  while((GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_2))==0); //µÈ´ýÄÚ²¿ÁãµçƽУ׼Íê³É

  {

  ReadFromAD7190(4,buf); //¶ÁÊý¾Ý¼Ä´æÆ÷

  InterFullAdjustData=(u32)buf[3]<<16;

  InterFullAdjustData|=(u16)buf[2]<<8;

  InterFullAdjustData|=buf[1];

  }

 

  buf[0] = 0x08; //д0x08µ½Í¨ÐżĴæÆ÷ ÅäÖá®Ä£Ê½¼Ä´æÆ÷¡¯

  WriteToAD7190(1,buf);

  buf[2] = 0x00; //Á¬Ðøת»»Ä£Ê½£¬×´Ì¬¼Ä´æÆ÷²»·¢ËÍ£¬Íⲿ4.9152M¾§Õñ

  buf[1] = 0x04; //sinc4Â˲¨Æ÷£¬½ûÖ¹ÆæżУ׼£¬REJ60=1£¬¸üºÃµÄ50HzÒÖÖÆ£¬Êä³öËÙÂÊ=90Hz

  buf[0] = 0x3f;

  WriteToAD7190(3,buf);

 

  buf[0] = 0x4c; //д0x4cµ½Í¨ÐżĴæÆ÷ ¶Á¡®Ä£Ê½¼Ä´æÆ÷¡¯0100 1100

  WriteToAD7190(1,buf);

  while((GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_2))==0);

  {

  ReadFromAD7190(4,buf); //¶ÁÊý¾Ý¼Ä´æÆ÷

  SampleSpeed=(u32)buf[3]<<16;

  SampleSpeed|=(u16)buf[2]<<8;

  SampleSpeed|=buf[1];

  }

  SampleSpeed&=0x003f; //¶Á³ö²ÉÑùËÙ¶È

  }

 

PS:通信没有问题

結果