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

◆ instr_Relays_driver_set_reset_channel_function()

void instr_Relays_driver_set_reset_channel_function ( void  )

Function to set the relais for detector bias.

Returns
No Parameters, the actual result is sent to the CAN bus output throught tx_data.
1011 uint8_t canale_, canale= vettore_istruzioni[istruzione_byte_4_e_scelta_canale];
1012 uint8_t switch_relay= vettore_istruzioni[istruzione_byte_3];
1013 uint8_t scheda_su_giu= (canale >> 7) & 1;
1014 ERROR_codifica_errore(0,0,0,0); //Reset_ch0 errori
1015 int32_t ADC_misura_fatta;
1016 bool si_commuta;
1017
1018 for ( canale_=0; canale_ <6; canale_++){
1019 if( (canale >> canale_) & 1){
1020 if ( (switch_relay & Detector_bias_invertito) ) { //(switch_relay >> select_external_bias)
1021 //Then external bias
1022 Relays_driver_set_reset_channel( scheda_su_giu, canale_ , Detector_bias_invertito);
1023 }
1024 if ((switch_relay &Detector_bias_diretto) ){
1025 //Direct bias
1026 Relays_driver_set_reset_channel( scheda_su_giu, canale_ , Detector_bias_diretto);
1027 }
1028 if ((switch_relay & Detector_large_RLOAD) ) {
1029 //Then bias unchanged
1030 Relays_driver_set_reset_channel( scheda_su_giu, canale_ , Detector_large_RLOAD );
1031 }
1032 if ((switch_relay & Detector_small_RLOAD)){
1033 Relays_driver_set_reset_channel( scheda_su_giu, canale_ , Detector_small_RLOAD);
1034 }
1035 if ((switch_relay & Detector_prea_to_GND) ) {
1036 //Then detector large RLOAD
1037 Relays_driver_set_reset_channel( scheda_su_giu, canale_ , Detector_prea_to_GND);
1038 }
1039 if ((switch_relay & Detector_prea_to_det)){
1040 Relays_driver_set_reset_channel( scheda_su_giu, canale_ , Detector_prea_to_det);
1041 }
1042 if ((switch_relay & Detector_external_bias) ) {
1043 //Then preamplifier to detector
1044 si_commuta=Detector_verifica_Vbias( scheda_su_giu, si_commuta);
1045 if (si_commuta){ //Vbias is within the limits
1047 }
1048 }
1049 if ((switch_relay & Detector_internal_bias)){
1050 si_commuta=Detector_verifica_Vbias( scheda_su_giu, si_commuta);
1051 if (si_commuta){ //Vbias is within the limits
1052 Relays_driver_set_reset_channel( scheda_su_giu, canale_ , Detector_internal_bias);
1053 }
1054 }
1055 }
1056}
1057 if( flag_error_verified){
1058
1059 }
1061}
static bool Detector_verifica_Vbias(uint8_t scheda_su_giu, bool si_commuta)
Function to verify if the Vbias voltage is within the limit to be swtitched.
void instr_Relays_driver_set_reset_channel_function(void)
Function to set the relais for detector bias.
void Relays_driver_set_reset_channel(uint8_t scheda_su_giu, uint8_t numero_canale, uint8_t valore_da_trasmettere)
Setting the state of the detector realis: pre connected to detector or intrnal resistor,...
#define Detector_small_RLOAD
#define Detector_prea_to_det
#define Detector_bias_invertito
#define Detector_external_bias
#define Detector_internal_bias
#define Detector_prea_to_GND
#define Detector_bias_diretto
#define Detector_large_RLOAD
void Error_imposta_la_istruzione(void)
Function to be located at the end of every instruction to mark the error, if any.
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.
#define istruzione_byte_3
Definition: Istruzioni.h:23
#define istruzione_byte_4_e_scelta_canale
Definition: Istruzioni.h:24
volatile int8_t vettore_istruzioni[8]
This is a copy of the received 8 bytes from the CAN.

Definition at line 1010 of file Detector_Bias.c.