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

◆ preamplifier_set_reset_pre_gain()

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

Here the 2 digital signals of the preamplifier's trimmer are exploited to set the gain of the preamplifier itself.

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_0use here the definitions:
Returns
No Parameters
61void preamplifier_set_reset_pre_gain (uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t set_2_reset_1_idle_0 ){
62
63 uint8_t spedizione[2];
64 if(scheda_su_scheda_giu) scheda_su_scheda_giu=6;
65
66 spedizione[1] = contenuto_trimmer_preamplifier[canale + scheda_su_scheda_giu][0] ; //The trimmer content has to be
67 //written each time the digital signals are set/reset
68
69 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, address_preamplifier_trimmer[canale].quale_I2C); //Select the I2C to be used
70
71 if( set_2_reset_1_idle_0) { //We operate only if we have to set
72
73 spedizione[0] = set_2_reset_1_idle_0 << 1 ; //The 2 bits are at position 1 and 2 of the byte
74
75
76 I2C_mux->MasterTransmit( (uint8_t) address_preamplifier_trimmer[canale].indirizzo_I2C , spedizione, 2,false); //Write the selected trimmer of the selcted channel
77
78 while( I2C_mux->GetStatus().busy); // White transmission complete
79
82 }
83
84 spedizione[0] =preamplifier_Gain_set_idle; // Both switches OFF, this operation is made always and can be made at the initialization
85
86 I2C_mux->MasterTransmit( (uint8_t) address_preamplifier_trimmer[canale].indirizzo_I2C , spedizione, 1,false); ///Set the trimmer to read
87
88 while( I2C_mux->GetStatus().busy); // White transmission complete
89
90 I2C_mux->MasterReceive( address_preamplifier_trimmer[canale].indirizzo_I2C, &tappo, 1,false); //Read back, the trimmer value
91
92 while( I2C_mux->GetStatus().busy){};
93
94 contenuto_trimmer_preamplifier[canale + scheda_su_scheda_giu][0] = tappo;
95}
#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 preamplifier_set_reset_pre_gain(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t set_2_reset_1_idle_0)
Here the 2 digital signals of the preamplifier's trimmer are exploited to set the gain of the preampl...
#define preamplifier_Gain_set_idle
. *‍/
void Aspetta_tanti_ms(int millisecondi)
The timing function.
Definition: Timer.c:52
const struct address_detector_bias_trimmer_type address_preamplifier_trimmer[6]
Preamplifier trimmer addresses
Definition: Trimmer.c:139
uint8_t volatile contenuto_trimmer_preamplifier[12][4]
Definition: Trimmer.c:179

Definition at line 61 of file Preamplifier_Gain.c.