It sets the new gain letting the output offset at the same level.
384 int misura_finale[2], offset;
385 char nodo_di_misura_1[]={ADC_ADC_PGA_neg_out_ch0, ADC_ADC_PGA_neg_out_ch1};
386 char nodo_di_misura_2[]={ADC_ADC_PGA_pos_out_ch0, ADC_ADC_PGA_pos_out_ch1};
393 for( canale=0;canale<2;canale++){
394 if( (chi_aggiustiamo >> canale) & 1){
396 valore_target_per_offset[canale]=correzione_misura_ADC(coeffcienti_misura_ADC_nodi[nodo_di_misura_1[canale]], offset);
398 if( (valore_target_per_offset[canale] >= saturazione_positiva) || ( valore_target_per_offset[canale] <= saturazione_negativa ) ) {
399 valore_target_per_offset[canale]=0;
402 valore_target_per_offset[canale] = ( valore_target_per_offset[canale] * (int)
guadagno_minimo_PGA ) / (int)guadagno_da_impostare ;
417 for( canale=0;canale<2;canale++){
418 if( (chi_aggiustiamo >> canale) & 1){
420 offset=correzione_misura_ADC(coeffcienti_misura_ADC_nodi[nodo_di_misura_1[canale]], offset) * (int)
guadagno_minimo_PGA / (
int)guadagno_da_impostare ;
421 int correzione = ( valore_target_per_offset[canale] - offset ) / (( (fine_trimmer_step[0]+fine_trimmer_step[1])>>1) ) ;
422 Trimmer_offset_preampli[canale].fine_offset= Trimmer_offset_preampli[canale].fine_offset - correzione;
423 if (Trimmer_offset_preampli[canale].fine_offset >255) Trimmer_offset_preampli[canale].fine_offset=255;
424 if( Trimmer_offset_preampli[canale].fine_offset <0 ) Trimmer_offset_preampli[canale].fine_offset=0;
425 Imposta_canale_del_trimmer_ennesimo_al_valore_I2CA (canale, preampli_fine_offset_trimmer, Trimmer_offset_preampli[canale].fine_offset);
uint8_t massimo_guadagno_impostabile
uint8_t guadagno_minimo_PGA
void PGA_preparation_to_gain_set(char chi_aggiustiamo, unsigned int guadagno_da_impostare)
It sets the new gain letting the output offset at the same level.
void PGA_GAIN_set(char canale, unsigned int guadagno_da_impostare)
It sets the new gain irrespective of the offset.