配置寄存器没有生效,读寄存器和读数据都没有输出,麻烦帮忙看看是哪里有问题。
初始化流程,RESET(ch1-4分别为CS、CLK、DIN、DOUT)
SDATAC
写寄存器,后面数据省略了
读寄存器,读取时DIN发送NOP
读取数据时,一直是一样的返回
附上初始化流程:
uint8 ADS1147_INIT()
{
/*register init data*/
uint8 InitData[15]={0x01,0x02,0x20,0x08,0x00,0x00,0x00,0x00,0x00,0x40, 0x06, 0x23, 0x00, 0x00, 0x00};
/*AIN0,AIN1,mid-supply BIAS on AIN1,internal oscillator,internal reference on,select external reference,PGA=1,DR=1KSPS,1mA,*/
/* BCS|VBIAS|MUX1|SYS0|OFC0|OFC1|OFC2|FSC0|FSC1|FSC2|IDAC0|IDAC1|GPIOCFG|GPIODIR|GPIODAT */
uint8 RecData[15];
uint8 initflag=0;
uint8 i;
ADC_START_EN(); /*Enable the device by setting the START pin HIGH */
SPI0_Pin_Init();
SPI0Master_Init();
Delay_US(500);
/*Config the DRDY pin as falling edge triggered interrupt input */
SPI0_SendByte(RESET); /*SEND RESET*/
Delay_US(500);
Delay_US(500);
Delay_US(500);
SPI0_SendByte(SDATAC);
Delay_US(100);
AD_WriteToRes(MUX0,0x0F,InitData);
AD_ReadFrRes(MUX0,0X0F,RecData);
SPI0_SendByte(SYNC);
Delay_US(10);
}