ADS8638
咨询:
我将ADS8638设置为自动模式,8个通道采集,但是读到的数据通道顺序是70123456,数据也是正确的,通道序号第一个不是应该是0通道的吗,各位知道是什么原因吗,谢谢
倾向于你操作的问题,上你的代码看看,应该是代码配置或者读取的问题。
void Get_AUTO_RST_Mode_Data(U16* outputdata, U8 chnum)
{
U8 i=0,datal=0,datah=0;
U16 data=0;
for (i=0; i<8; i++)
{
ADS8638CS = 0;
datah = SPI_ReadWriteByte(0X00);
datal = SPI_ReadWriteByte(0X00);
ADS8638CS = 1;
data = datah<<8 | datal; //高位在前,低位在后
*(outputdata+i) = data;
}
for (i=8; i<chnum; i++)
{
ADS8634CS = 0;
datah = SPI_ReadWriteByte(0X00);
datal = SPI_ReadWriteByte(0X00);
ADS8634CS = 1;
data = datah<<8 | datal; //高位在前,低位在后
*(outputdata+i) = data;
}
}这是自动读取的代码
void Set_CH_And_Range_Select(void) //设置通道和范围
{
ADS8638_Write_Program_Register(0x0C,0xFF);
ADS8634_Write_Program_Register(0x0C,0xFF);
ADS8638_Write_Program_Register(0x10,0x55);
ADS8638_Write_Program_Register(0x11,0x55);
ADS8638_Write_Program_Register(0x12,0x55);
ADS8638_Write_Program_Register(0x13,0x55);
ADS8634_Write_Program_Register(0x10,0x50);
ADS8634_Write_Program_Register(0x11,0x50);
ADS8634_Write_Program_Register(0x12,0x50);
ADS8634_Write_Program_Register(0x13,0x50);
}
void AUTO_Mode(void) //进入自动扫描模式
{
ADS8638_Write_Program_Register(0x05,0x00);
ADS8634_Write_Program_Register(0x05,0x00);
}麻烦看看哪个地方存在问题