CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
Loading...
Searching...
No Matches

◆ PGA_set_reset_pre_PGA_gain()

void PGA_set_reset_pre_PGA_gain ( uint8_t  scheda_su_scheda_giu,
uint8_t  canale,
uint8_t  set_2_reset_1_idle_0 
)

Here the 2 digital signals from the trimmer are exploited to set the gain of the input stage of the PGA.

Parameters
[in]scheda_su_scheda_giuone of the 2 boards that the postfrontend manages
[in]canalethe channel for which we need to manage the trimmer
[in]set_2_reset_1_idle_0if 1 the gain is at 10, if 0 the gain is 1
Returns
No Parameters
143void PGA_set_reset_pre_PGA_gain (uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t set_2_reset_1_idle_0 ){
144
145 uint8_t spedizione[2];
146 if( scheda_su_scheda_giu) scheda_su_scheda_giu=6;
147
148 spedizione[1] = contenuto_trimmer_detector[canale + scheda_su_scheda_giu][0] ; //The trimmer content has to be
149 //written each time the digital signals are set/reset
150
151 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, address_detector_bias_trimmer[canale].quale_I2C); //Select the I2C to be used
152
153 if( set_2_reset_1_idle_0) { //We operate only if we have to set
154
155 spedizione[0] = set_2_reset_1_idle_0 << 1 ; //The 2 bits are at position 1 and 2 of the byte
156
157
158 I2C_mux->MasterTransmit( (uint8_t) address_detector_bias_trimmer[canale].indirizzo_I2C , spedizione, 2,false); //Write the selected trimmer of the selcted channel
159
160 while( I2C_mux->GetStatus().busy); // White transmission complete
161
164 }
165
166 spedizione[0] =set_pre_pga_idle; // Both switches OFF, this operation is made always and can be made at the initialization
167
168 I2C_mux->MasterTransmit( (uint8_t) address_detector_bias_trimmer[canale].indirizzo_I2C , spedizione, 1,false); ///Set the trimmer to read
169
170 while( I2C_mux->GetStatus().busy); // White transmission complete
171
172 I2C_mux->MasterReceive( address_detector_bias_trimmer[canale].indirizzo_I2C, &tappo, 1,false); //Read back, the trimmer value
173
174 while( I2C_mux->GetStatus().busy){};
175
176 contenuto_trimmer_detector[canale + scheda_su_scheda_giu][0] = tappo;
177}
void PGA_set_reset_pre_PGA_gain(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t set_2_reset_1_idle_0)
Here the 2 digital signals from the trimmer are exploited to set the gain of the input stage of the P...
Definition: DAC_PGA.c:143
#define set_pre_pga_idle
The swirches are set both off.
Definition: DAC_PGA.h:9
#define wait_time_for_rele_setting
[ref_spi_clock_for_relais]
volatile uint32_t Error_bad_operation
exploited to mark the errors
void ERROR_codifica_errore(uint8_t scheda_su_scheda_giu, unsigned char error_addres, unsigned char code_to_shift, uint8_t reset_count_se_0)
If an error is found its flag is codified here.
@ I2C_Error_trimmer_0
trimmer ch0
@ error_address_I2C0
Error register A for I2C0.
void I2C_mux_select_ch(uint8_t scheda_su_scheda_giu, uint8_t mainboard_postmainboard, uint8_t canale_da_abilitare)
The I2C mux.
Definition: I2C_mux.c:100
void Aspetta_tanti_ms(int millisecondi)
The timing function.
Definition: Timer.c:52
const struct address_detector_bias_trimmer_type address_detector_bias_trimmer[6]
Detector trimmer addresses.
Definition: Trimmer.c:129
uint8_t contenuto_trimmer_detector[12][4]
Content of the trimmer for detector bias system.
Definition: Trimmer.c:161

Definition at line 143 of file DAC_PGA.c.