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

◆ instruction_Vbias_target()

void instruction_Vbias_target ( void  )

The detector bias will be set at the value passed from the CAN if, after this setting, it is launched instruction_Detector_bias().

The first 4 bytes of the CAN bus message are the 2 voltage setting in mV.

Returns
No Parameters, the actual result is sent to the CAN bus output throught tx_data.
286uint8_t canali_ , canali_input=vettore_istruzioni[istruzione_byte_4_e_scelta_canale];
287 uint8_t scheda_su_giu = ((canali_input >> 7) & 1)*6;
288 uint8_t offset_scheda=0;
289 int32_t bias_to_apply,ADC_max_bias_pos, ADC_min_bias_neg;
290 if (scheda_su_giu){
291 offset_scheda=6;
292 }
299 bias_to_apply=(( *(uint16_t *)vettore_istruzioni ) & 0xFFFF) *1000;
300
301 if(ADC_max_bias_pos > ADC_min_bias_neg){
302 ADC_max_bias_pos=ADC_min_bias_neg; //prendiamo la pi\'u piccola delle 2 tensioni
303 }
304
305 if(bias_to_apply > ADC_max_bias_pos){
306 bias_to_apply=ADC_max_bias_pos;
307 }
308 ADC_max_bias_pos =bias_to_apply/1000;
309 tx_data[0]= ADC_max_bias_pos & 0xff;
310 tx_data[1]= (ADC_max_bias_pos >>8) & 0xff; //Ritorniamo il valore effettivo impostato
311
312
313 for( canali_=0; canali_ <6; canali_ ++){
314 if( (canali_input >> canali_) & 1){
315// Detector_bias_target[offset_scheda + canali_]= (( *(uint16_t *)vettore_istruzioni ) & 0xFFFF) *1000 ;
316
317 Detector_bias_target[canali_ + scheda_su_giu]= bias_to_apply ; //Lasciamo il limite a 6
318 }
319 }
321}
int32_t ADC_misura_differenziale_con_media_generico(uint8_t scheda_su_scheda_giu_, uint8_t preamplifier_externalADC_1_onboardADC_0, uint8_t nodo_da_misurare, uint8_t differenziale_1_single_0)
This function sets the original gain when a few LSb have to be determined. The umber of bits is bit_t...
Definition: Adc.c:899
volatile uint16_t ADC_medie_per_misura
the number of ADC readings to average, the maximum is 400
Definition: Adc.c:206
volatile bool ADC_non_leggi_lo_offset_se_true
if not necessary, the ADC input offset from buffer is not read
Definition: Adc.c:200
uint8_t tx_data[8]
Transmission data vector.
Definition: Can.c:321
int32_t Detector_bias_target[12]
Detector bias target values.
void instr_detector_Vbias_we_want_to_set_function(void)
#define Detector_max_limit_to_rail
Definition: Detector_Bias.h:24
#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 1119 of file Detector_Bias.c.