我在用ads1247驱动PT100时,数据采集不准确,求助啊
时间:10-02
整理:3721RD
点击:
我的原理图采用的时ads1247手册上的电路图,但是我在使用时得不到正确的值,我用程序读取ads1247内部的寄存器,可以得到初始化的值,说明程序是没问题的,芯片应该也没坏,但是参考电阻RRef=820的电阻上始终得不到1.64v的电压,VREfcom和VREFOUT之间的电容的电压是2.04V,我想采集不到正确的值,应该和RREF两端得不到1.64V的电压有关,但是我不知道哪里有问题了,求助啊
我的初始化代码如下
void ADS1247_init(void) { SPI2_Config(); Delay_ms(2); START_HIGH; Delay_ms(20); RESET_HIGH; Delay_ms(2); while(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_8) == 1); CS_LOW; Delay_ms(2); SPI2_SendByte(CMD_Reset); Delay_ms(2); ADS1247_Calibrate(); Delay_ms(2); SPI2_SendByte(CMD_RDataC); Delay_ms(2); ADS1247WREG(Reg_MUX0, 0x0A); ////¹Ø±ÕµçÁ÷Ô´£¬ÕýÊäÈëͨµÀAIN1£¬¸ºÊäÈëͨµÀAIN2. Delay_ms(2); ADS1247WREG(Reg_VBias, 0x00); //¹Ø±ÕÆ«Öõçѹ Delay_ms(2); ADS1247WREG(Reg_MUX1, 0x38); //ʽÖдò¿ªÄÚ²¿²Î¿¼ Delay_ms(2); ADS1247WREG(Reg_SYS0, 0x22); //PGA=4, 20sps Delay_ms(2); ADS1247WREG(Reg_IDAC0, 0x06); //µçÁ÷Ô´µçÁ÷1ma Delay_ms(2); ADS1247WREG(Reg_IDAC1, 0x03); //µÚÒ»¸ö¼¤ÀøµçÁ÷Êä³öÒý½ÅAIN0£¬µÚ¶þ¸öÊÇAIN3 Delay_ms(2); SPI2_SendByte(CMD_SYNC); Delay_ms(2); SPI2_SendByte(0xff); Delay_ms(2); // CS_HIGH; } float ADS1247_DATA(void) { u32 value; float temp1,temp2; while(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_8) == 1); CS_LOW; SPI2_SendByte(CMD_RData); Delay_ms(2); value = SPI2_SendByte(0xff) << 16; value += SPI2_SendByte(0xff) << 8; value += SPI2_SendByte(0xff); Delay_ms(2); CS_HIGH; if(value < 0x7fffff || value == 0x7fffff) { temp1 = (1.64*value/0x7fffff*1000/4- 100) / 0.39; } if(value > 0x7fffff) { temp1 = (-1.64 * (0xffffff - value + 1) / 0x7fffff * 1000 / 4 - 99) / 0.39; } return temp1 ; } void ADS1247_Calibrate(void) { ADS1247WREG(Reg_SYS0, 0x22); //PGA=4, 20sps ADS1247WREG(Reg_MUX1, 0x20); SPI2_SendByte(CMD_SELFOCAL); while(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_8) == 1); ADS1247WREG(Reg_MUX1, 0x21); SPI2_SendByte(CMD_SYSOCAL); while(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_8) == 1); ADS1247WREG(Reg_MUX1, 0x22); SPI2_SendByte(CMD_SYSGCAL); while(GPIO_ReadInputDataBit(GPIOD, GPIO_Pin_8) == 1); }
我觉得你的电路在连接传感器部分和手册的推荐电路差别很大.