Пн сен 03, 2018 14:08:44
void ADC_SetConfig (void) {
// stop continuous read mode
ADC_SendCommand(ADC_CMD_SDATAC);
// set continuous conversion mode
// set sample rate to 125sps
ADC_WriteRegister(ADC_REG_CONFIG1, 0b00000000);
// enable internal reference
// set internal reference to 2.42v
ADC_WriteRegister(ADC_REG_CONFIG2, 0b10100000);
// enable channel 1
// gain x1
// input shorted
ADC_WriteRegister(ADC_REG_CH1SET, 0b00010001);
// enable channel 2
// gain x12
// normal electrode input
ADC_WriteRegister(ADC_REG_CH2SET, 0b01100000);
// RLDREF signal (AVDD – AVSS) / 2 generated internally
// calibration on
ADC_WriteRegister(ADC_REG_RESP2, 0x83);
// enable RLD buffer
ADC_WriteRegister(ADC_REG_RLD_SENS, 0x20);
// init the remaining registers with default values
ADC_WriteRegister(ADC_REG_LOFF, 0x10);
ADC_WriteRegister(ADC_REG_LOFF_SENS, 0x00);
ADC_WriteRegister(ADC_REG_LOFF_STAT, 0x00);
ADC_WriteRegister(ADC_REG_RESP1, 0x02);
ADC_WriteRegister(ADC_REG_GPIO, 0x00);
ADC_SendCommand(ADC_CMD_OFFSETCAL);
}
Ср дек 12, 2018 21:38:59