ads1220初始化
我目前在用ADS1220,目前有个问题不明白?我测量热电偶,用PT100做冷端补偿。热电偶T+接AIN2,T-接AIN3,PT100一端接AIN0,另一端接AIN1.
目前ADS1220初始化,
第一种情况:第一步测量热电偶的电压,AINP配置T+,AINN配置T-,正常模式,单次测量,使用PGA,增益32,数据更新20sps,试用内部基准,内部温度传感器关闭。像其他的AIN0,AIN1,恒流源灯还需要配置吗?第二步测量PT100,除了配置和PT100相关的,不相关的是否还需要配置?
第二种情况:还是一次性配置完ADS1220热电偶和PT100通道所有参数,然后切换通道读取每个通道测量数据?
我看了咱们的DEMO例程,每次读取数据前都是重新初始化,我不是很明白这是什么意思?咱们这样做有什么好处吗?希望给解释一下谢谢
还有一个问题:就是关于DRDY的。我使用查询的方法判断,比如如果一直是高电平。我不应该一直在这里死等,我应该有个超时判断。咱们这里的这个超时时间是怎么设定的?你看是不是这样的,1*数据更新速率相对应的时钟数目/256KHZ,是这样的吗?
这样 DEMO 程序稳定性不错, 但效率并不高.
其实推荐的是用中断去捕捉 DRDY 信号, 而超时判断是个好思路. 时间设置应该不小于 正常 DRDY 周期
1.超时时间是怎么设定的?你看是不是这样的,1*数据更新速率相对应的时钟数目/256KHZ,是这样的吗?比如我设置正常模式,数据采集是20sps,DRDY转换完时
钟是204850超时时间是不是1*204850/256。
2.ADS1220初始化两种情况:
A.采集热电偶,冷端是PT100,ADS1220初始化是我一次性配置完所有参数,然后切换通道读取通道数据.
B.第一步测量热电偶的电压,配置和热电偶相关的,不配置关于PT100的,然后采集读取数据。第二步配置和PT100相关的,不配置和热电偶相关的,然后采集读取数据。通过两次的采集计算温度。
这两种采用哪种配置呀?看DEMO都糊涂了。TI 的DEMO和我前面说的都不一样,TI的DEMO为什么这样,有什么好处吗?
void main (void)
{
Setup_SPI_Master ();
ADS1220_Reset();
Setup_ADS1220 (ADS1220_MUX_AIN3_AIN2, ADS1220_OP_MODE_NORMAL,
ADS1220_CONVERSION_SINGLE_SHOT, ADS1220_DATA_RATE_20SPS, ADS1220_GAIN_32, ADS1220_USE_PGA,
ADS1220_IDAC1_AIN3, ADS1220_IDAC2_DISABLED, ADS1220_IDAC_CURRENT_250_UA, ADS1220_VREF_EXT_REF0_PINS);
__delay_cycles(CPU_CLK/2);
while (1)
{
// Configure ADS1220 for first RTD measurement
Setup_ADS1220 (ADS1220_MUX_AIN3_AIN2, ADS1220_OP_MODE_NORMAL,
ADS1220_CONVERSION_SINGLE_SHOT, ADS1220_DATA_RATE_20SPS, ADS1220_GAIN_32, ADS1220_USE_PGA,
ADS1220_IDAC1_AIN3, ADS1220_IDAC2_DISABLED, ADS1220_IDAC_CURRENT_250_UA, ADS1220_VREF_EXT_REF0_PINS);
__delay_cycles(CPU_CLK/1000);
ReadConversionData = 0;
ADS1220_Start ();
while (!ReadConversionData); // Wait for Data Ready interrupt
ADS1220_Get_RTD_Conversion_Data_Calibrated (&ADS1220RTDdata); // Get the temperature data with the calibration value subtracted
// Configure ADS1220 for second chopped RTD measurement
Setup_ADS1220 (ADS1220_MUX_AIN2_AIN3, ADS1220_OP_MODE_NORMAL,
ADS1220_CONVERSION_SINGLE_SHOT, ADS1220_DATA_RATE_20SPS, ADS1220_GAIN_32, ADS1220_USE_PGA,
ADS1220_IDAC1_AIN3, ADS1220_IDAC2_DISABLED, ADS1220_IDAC_CURRENT_250_UA, ADS1220_VREF_EXT_REF0_PINS);
RTDtemperature = ADS1220RTDdata;
__delay_cycles(CPU_CLK/1000); //
ReadConversionData = 0;
ADS1220_Start (); // Only one start needed for Continuous Mode
while (!ReadConversionData); // Wait for Data Ready interrupt
ADS1220_Get_RTD_Conversion_Data_Calibrated (&ADS1220RTDdata); // Get the temperature data with the calibration value subtracted
// Configure ADS1220 for first Thermocouple measurements
Setup_ADS1220 (ADS1220_MUX_AIN0_AIN1, ADS1220_OP_MODE_NORMAL,
ADS1220_CONVERSION_SINGLE_SHOT, ADS1220_DATA_RATE_20SPS, ADS1220_GAIN_32, ADS1220_USE_PGA,
ADS1220_IDAC1_AIN3, ADS1220_IDAC2_DISABLED, ADS1220_IDAC_CURRENT_250_UA, ADS1220_VREF_INTERNAL);
RTDtemperature += ADS1220RTDdata; //now averaging RTD results
RTDtemperature = RTDtemperature/2;
RTDtemperature = interpolateRTDTemperatureValue (RTDtemperature); // Get the RTD temperature and convert into millidegrees C
//cold junction compensation
CJCcode = calc_CJC(RTDtemperature); // convert RTD temperature into thermocouple voltage
__delay_cycles(CPU_CLK/1000); //
ReadConversionData = 0;
ADS1220_Start ();
while (!ReadConversionData); // Wait for Data Ready interrupt
ADS1220_Get_TC_Conversion_Data_Calibrated (&ADS1220TCdata); // Get the temperature data with the calibration value subtracted
TCtemperature = ADS1220TCdata/2;
// Configure ADS1220 for second chopped Thermocouple measurements
Setup_ADS1220 (ADS1220_MUX_AIN1_AIN0, ADS1220_OP_MODE_NORMAL,
ADS1220_CONVERSION_SINGLE_SHOT, ADS1220_DATA_RATE_20SPS, ADS1220_GAIN_32, ADS1220_USE_PGA,
ADS1220_IDAC1_AIN3, ADS1220_IDAC2_DISABLED, ADS1220_IDAC_CURRENT_250_UA, ADS1220_VREF_INTERNAL);
__delay_cycles(CPU_CLK/1000);
ReadConversionData = 0;
ADS1220_Start (); // Only one start needed for Continuous Mode
while (!ReadConversionData); // Wait for Data Ready interrupt
ADS1220_Get_TC_Conversion_Data_Calibrated (&ADS1220TCdata); // Get the temperature data with the calibration value subtracted
ADS1220TCdata = ADS1220TCdata/2;
TCtemperature -= ADS1220TCdata;
TCtemperature += CJCcode; //CJC
TCtemperature = interpolateTCTemperatureValue (TCtemperature); // Get the temperature and convert into millidegrees C
}
这是TI的DEMO 也是做热电偶采集,冷端补偿是PT100.这里面的初始化参数,有一样的也有不一样的,我看了它的初始化糊涂了。希望大家给解释一下
TI的技术支持做什么呢?我问了好久了都没有答复?是不愿意解答还是怎么回事?还有我之前的一个帖子,TI的技术支持都没有给解决,比较失望?