AD7770 gain correction understand

Hello.

I try to make the AD7770 read all ch with gain=1 no offset and no gain correction.

I use AD7779 example of  Analog device in the GitHub which has only .c .h files (and lot of mistake I manage to correct by me or other google search).

The main setting is as follow 

/* Device Settings */
dev.spi_crc_en = ad7770_DISABLE;
dev.spi_op_mode = ad7770_INT_REG;
dev.sar_state = ad7770_DISABLE;
dev.sar_mux = ad7770_AUXAINP_AUXAINN;
dev.ref_type = ad7770_EXT_REF;
dev.pwr_mode = ad7770_HIGH_RES;
dev.dec_rate_int = 2048; //4;
dev.dec_rate_dec = 0; //10;

ad7770_update_cached_reg_val();

for (i = ad7770_CH0; i <= ad7770_CH7; i++) {
dev.state[i] = ad7770_ENABLE;
dev.gain[i] = ad7770_GAIN_1;
ad7770_set_state( (ad7770_ch)i, dev.state[i]);
ad7770_set_gain((ad7770_ch)i, dev.gain[i]);
dev.sync_offset[i] = 0;
dev.offset_corr[i] = 0;
dev.gain_corr[i] = 0;
ad7770_set_sync_offset((ad7770_ch)i, 0);
ad7770_set_offset_corr((ad7770_ch)i, 0);
ad7770_set_gain_corr((ad7770_ch)i, 0);
}

ad7770_spi_int_reg_write_mask(AD7770_REG_DOUT_FORMAT,
ad7770_DOUT_HEADER_FORMAT, dev.ctrl_mode == ad7770_SPI_CTRL ? 0 : 1);
ad7770_set_dclk_div(ad7770_DCLK_DIV_2);
ad7770_set_dec_rate(dev.dec_rate_int, dev.dec_rate_dec);
ad7770_set_reference_type(dev.ref_type);
ad7770_set_power_mode(dev.pwr_mode);

ad7770_set_src_source(ad7770_SRC_LOAD_SW);

Using this setting give all the time zero  result on the SPI.

Then I read all the register of the AD7770 EV I have and found strang number in the gain correction.

I put it in my setting


ad7770_set_gain_corr((ad7770_ch)i, 5590965); where it is write to AD7770_REG_CH_GAIN_UPPER_BYTE/MID/LOWER

and then it start give result.

1. What this register response for?

2. why this number ?

3. How it relate to give true reading on the output?

Anonymous