The detector bias will be set at the value passed from the CAN with this function if, after this setting, it is launched instr_Vbias_to_be_set_function().
The first 2 bytes of the CAN bus message are the voltage setting in mV. Byte_6 is for which channel the voltage is to be set. The same voltage can be the same for several channels. The voltage is applied if the corresponding bit of Byte_6 is 1, ie if bit_2 is 1, than the voltage is applied to channel 1, if bit_1 and bit_5 are 1 then the same voltage is applied for both channles 1 and 5. Run the command several times if the targety is different among the channles. These values are stored in the vector Detector_bias_target[12]. Only positive values are accepted and the voltage is considered the total bias voltage, namely Voltage==Vbias_pos - Vbias_neg, symmetric.
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;
301 if(ADC_max_bias_pos > ADC_min_bias_neg){
302 ADC_max_bias_pos=ADC_min_bias_neg;
305 if(bias_to_apply > ADC_max_bias_pos){
306 bias_to_apply=ADC_max_bias_pos;
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;
313 for( canali_=0; canali_ <6; canali_ ++){
314 if( (canali_input >> canali_) & 1){
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...
volatile uint16_t ADC_medie_per_misura
the number of ADC readings to average, the maximum is 400
volatile bool ADC_non_leggi_lo_offset_se_true
if not necessary, the ADC input offset from buffer is not read
uint8_t tx_data[8]
Transmission data vector.
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
#define istruzione_byte_4_e_scelta_canale
@ node_voltage_Analog_Mux_meas_input_bias_neg
@ node_voltage_Analog_Mux_meas_input_bias_pos
volatile int8_t vettore_istruzioni[8]
This is a copy of the received 8 bytes from the CAN.