This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1255: 我在初始化时候,给0x53 写入了采样频率为2.5,调用读取函数处,我再次向0x53写入0x03,即采样频率2.5,但是使用示波器观察drdy信号的频率发现有问题,是30k的采样频率的间隔

Part Number: ADS1255
Other Parts Discussed in Thread: ADS1256

我的初始化代码如下

void ADS1255_Init(void)
{
uint8_t buff;
/*****************自校准的过程*******************/
while(DRDY1)
{}
;
CS1_L;
/****************设置ADS1256的ADC工作模式*****************/


ADS1255WREG(0x50,0x06); 
ADS1255WREG(0x51,0x01);
ADS1255WREG(0x52,0x20); 
ADS1255WREG(0x53,0x03);
ADS1255WREG(0x54,0x00);


delay_us(100);
/*******************再一次自校准***************************/

while(DRDY1)
{};
buff = 0xF0;
HAL_SPI_Transmit(&hspi1,&buff,1,1000); //补偿和增益自我校准命令
// delay_us(5);
HAL_Delay(2000); //自校准时间需要1200ms
buff = 0xfc;
HAL_SPI_Transmit(&hspi1,&buff,1,1000); //sync
HAL_Delay(20);
buff = 0xFF;
HAL_SPI_Transmit(&hspi1,&buff,1,1000); //wake
delay_us(5);

CS1_H;


}

我的读取函数如下

double ReadAnAdc()
{
uint8_t buff;
uint32_t Data1 = 0;
double ReadVoltage;
CS1_L;
while(DRDY1)
{};

ADS1255_SPI1_ReadWriteByte(0x51);
ADS1255_SPI1_ReadWriteByte(0x00); //不是唤醒待机和同步命令,写进字节数为0+1
ADS1255_SPI1_ReadWriteByte(0x01); //要写进寄存器的数据


ADS1255_SPI1_ReadWriteByte(0x53);
ADS1255_SPI1_ReadWriteByte(0x00); //不是唤醒待机和同步命令,写进字节数为0+1
ADS1255_SPI1_ReadWriteByte(0x03);//要写进寄存器的数据

buff = 0xF0;
HAL_SPI_Transmit(&hspi1,&buff,1,1000); //补偿和增益自我校准命令
delay_us(5);

buff = 0xfc;
HAL_SPI_Transmit(&hspi1,&buff,1,1000); //sync

buff = 0x00;
HAL_SPI_Transmit(&hspi1,&buff,1,1000); //wake
delay_us(5);


buff = 0x01;
HAL_SPI_Transmit(&hspi1,&buff,1,1000); //rdata
delay_us(10);
HAL_SPI_Receive(&hspi1,&data[0],1,1000);
HAL_SPI_Receive(&hspi1,&data[1],1,1000);
HAL_SPI_Receive(&hspi1,&data[2],1,1000);




CS1_H;
Data1 = (data[0]<<16) + (data[1]<<8) + data[2];


if(Data1>0x7fffff)
{
Data1 -=0x1000000;
}
if(Data1&0x800000)
{
Data1 =~(unsigned long)Data1;
Data1 &=0x7fffff;
Data1 +=1;
}



return Data1;
}



附件中可以看到drdy信号的频率