微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 硬件电路设计 > TI模拟硬件电路设计 > ADS1256的状态寄存器读取问题

ADS1256的状态寄存器读取问题

时间:10-02 整理:3721RD 点击:

初始化ADS1256之后,

void ADS1256_Init(void)
{
/*Init data ready line */
ADS1256_Config_GPIO();

/*Init SPI2 for ADS1256 interface */
SPIx_Initialize(SPI2);

ADS1256_SetCommand(CMD_RESET);
ADS1256_DelayNumUs(100000); //wait for Vref is stable

/*it is strongly recommended to perform an additional self-calibration by issuing
the SELFCAL command after the power supplies and voltage reference have had time
to settle to their final values in pdf.27*/
while(ReadDrdyLine());
ADS1256_SetCommand(CMD_SELFCAL);

while(ReadDrdyLine());
/*Most Significant Bit First,Auto-Calibration Enabled,Buffer Enabled:11110111b */
ADS1256_WriteReg(REG_STATUS ,0xF7);

while(ReadDrdyLine());
/*PGA=1 */
ADS1256_WriteReg(REG_ADCON,0x00);

while(ReadDrdyLine());
/*select channle AIN2 as initial analog input*/
ADS1256_SetSingleChannel(2);

while(ReadDrdyLine());
/*set data rate as 10sps as initial rate*/
ADS1256_WriteReg(REG_DRATE,RATE_5SPS);

/*After changing the PGA, data rate, buffer status, writing to the OFC or FSC registers,
and enabling or disabling the sensor detect circuitry,perform a synchronization operation
to force DRDY high. It will stay high until valid data is ready*/
while(ReadDrdyLine());
ADS1256_SetCommand(CMD_SYNC);//synchronization command
ADS1256_SetCommand(CMD_WAKEUP);//wakeup command


while(ReadDrdyLine());
ADS1256_SetCommand(CMD_SELFCAL);
ADS1256_DelayNumUs(10);//it is important for this delay
/*When the voltage on VREFP or VREFN exceeds the buffer analog input range
(AVDD – 2.0V), the buffer must be turned off during self gain calibration.*/

}

配置ADS1256的STATUS状态寄存器的值为0xF7,然后去读这个状态寄存器的值,结果为0x30,这是为什么呢?(读其他的寄存器的值,却和配置的一样。)

求各位TI的老师指点一下。。。

状态寄存器是只读的, 0x30 的意义详细见数据手册的说明吧, P30

ADS1256的datasheet中并没有说明STATUS是只读的,只是说明STATUS寄存器的前四个bit位是只读的,后面的bit[1:3]是可以写的,肯定是可写的。不然无法正确配置ADS1256。

问题原因找到了:在datasheet中有这样一段话:/*it is strongly recommended to perform an additional self-calibration by issuing the SELFCAL command after the power supplies and voltage reference have had time to settle to their final values in pdf.27*/  所以在初始化ADS125之前,应该发一个自校准命令。但是需要注意的是发送自校准命令应该这样处理:

while(ReadDrdyLine());
ADS1256_SetCommand(CMD_SELFCAL);
while(!ReadDrdyLine());
while(ReadDrdyLine());

在完成ADS1256之后,也应该发一个自校准命令,以上述代码格式,然后继续去回读已配置的寄存器,就能读到正确的值。

我现在可以读取寄存器的数据,但是读取不了电压的数据,这种情况你有没有试过啊?

求ads1255驱动,我也在用ads1255,DRDY输出不对,怎么办?求大神指教!

你好,可以留下QQ么,咱们可以交流下。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top