void ADS1247_Init(void)
{
ADS1247_WriteByte(ADS_WAKEUP);
delay_AD(12800);//delay 16ms
{
ADS1247_WriteByte(ADS_WAKEUP);
delay_AD(12800);//delay 16ms
Chip_SCU_PinMuxSet(0x1, 10, SCU_MODE_FUNC0);//PIN1_10--> FONC0
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 3);
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT,1,3);//ADS1247_STA_H PIN1_10
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 3);
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT,1,3);//ADS1247_STA_H PIN1_10
ADS1247_SPIConfig();
Chip_SCU_PinMuxSet(0x1, 9, SCU_MODE_FUNC0);//PIN1_9--> FONC0
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 2);
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,1,2);//ADS1247_CS_L PIN1_9
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 1, 2);
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT,1,2);//ADS1247_CS_L PIN1_9
delay_AD(100);//Delay for a minimum of tCSSC=10ns
ADS1247_WriteByte(ADS_RESET);
delay_AD(1000);//Delay for a minimum of 0.6 ms
ADS1247_WriteByte(ADS_SDATAC);
ADS1247_WriteByte(ADS_RESET);
delay_AD(1000);//Delay for a minimum of 0.6 ms
ADS1247_WriteByte(ADS_SDATAC);
ADS1247_SetInputChannel(P_AIN0, N_AIN1);
ADS1247_SetReference(REF_Inter_AlwaysOn, SELT_Inter);//USE_INTER_VREF
ADS1247_SetDRDYMODE(Drdy_Mode_EN);
ADS1247_SetIDAC_Imag(IMAG_1000);
ADS1247_SetIDAC_Output(IDAC1_AIN0, IDAC2_AIN1);
ADS1247_SetPGAGainAndDataRate(PGAGain_1, DataRate_20);//20SPS gain=1
ADS1247_ReadREG(ADS_MUX0,1);
ADS1247_ReadREG(ADS_VBIAS,1);
ADS1247_ReadREG(ADS_MUX1,1);
ADS1247_ReadREG(ADS_SYS0,1);
ADS1247_ReadREG(ADS_IDAC0,1);
/ ADS1247_ReadREG(ADS_IDAC1,1);
ADS1247_SetReference(REF_Inter_AlwaysOn, SELT_Inter);//USE_INTER_VREF
ADS1247_SetDRDYMODE(Drdy_Mode_EN);
ADS1247_SetIDAC_Imag(IMAG_1000);
ADS1247_SetIDAC_Output(IDAC1_AIN0, IDAC2_AIN1);
ADS1247_SetPGAGainAndDataRate(PGAGain_1, DataRate_20);//20SPS gain=1
ADS1247_ReadREG(ADS_MUX0,1);
ADS1247_ReadREG(ADS_VBIAS,1);
ADS1247_ReadREG(ADS_MUX1,1);
ADS1247_ReadREG(ADS_SYS0,1);
ADS1247_ReadREG(ADS_IDAC0,1);
/ ADS1247_ReadREG(ADS_IDAC1,1);
ADS1247_WriteByte(ADS_SYNC);
delay_AD(100);//Delay for a minimum of tCSSC=10ns
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT,1,2);//ADS1247_CS_H PIN1_9
}
}
以上为初始化代码段, 使用picoscope连接DOUT读取寄存器的值时,每次都不一样,并且和之前设置的寄存器值完全不一样ADC.rar