CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
Loading...
Searching...
No Matches
Detector_Bias.h File Reference
#include "stdint.h"
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  Detector_coefficiente_type
 
struct  EPROM_detector_
 
struct  detector_SAR_ini_type
 
struct  detector_trimmer_type
 

Macros

#define bias_reading_attenuation_extern   ((1.8 + 18)/1.8 )*1024.0
 < Attenuation for bias reading
 
#define bias_reading_attenuation   ((1.5 + 8.2)/1.5 )*1024.0
 Trimmer coarse step in microV/step at the reading attenuation node.
 
#define trimmer_bias_coarse_step   (float) ((10.0*20.0/22.0/255.0)*(10.0/1.5)* 1e6 ) /*237 mV/count*/
 Trimmer fine step in microV/step

 
#define trimmer_bias_fine_step   (float) ((10.0*20.0/22.0/255.0)*(10e3/(10e3+1e6))*(10.0+1.5)/1.5*1e6 ) /*2.7 mV/count*/
 
#define trimmer_bias_coarse_pos   0
 
#define trimmer_bias_fine_pos   2
 
#define trimmer_bias_coarse_neg   1
 
#define trimmer_bias_fine_neg   3
 
#define Detector_min_voltage_for_switch   (int32_t) 1e6
 
#define Detector_max_voltage_for_switch   (int32_t) 6e6
 
#define Detector_max_limit_to_rail   (int32_t) 0.3e6
 
#define minimum_error_detector_voltage   10000 /*Minimum settbale voltage error for detector bias above */
 < Minimum settbale voltage error for detector bias above

 
#define detector_OA_inverting_gain_x_1000   6666
 
#define detector_OA_non_inverting_gain_x_1000   7666
 
#define detector_fine_trimmer_attenuation   101
 
#define detector_attenuazione_della_lettura_x_1000   7250
 
#define detector_trimmer_attenuation_x_1000   909
 
#define Detector_default_coarse_trimmer   233e5
 
#define Detector_default_fine_trimmer   2720
 
#define Detector_scrivi_il_trimmer   1
 
#define Detector_leggi_il_trimmer   0
 
#define Detector_trimmer_coarse_bias_pos   (uint8_t)0
 
#define Detector_trimmer_coarse_bias_neg   (uint8_t)1
 
#define Detector_trimmer_fine_bias_pos   (uint8_t)2
 
#define Detector_trimmer_fine_bias_neg   (uint8_t) 3
 

Typedefs

typedef struct EPROM_detector_ EPROM_detector__
 

Functions

void instr_detector_Vbias_we_want_to_set_function (void)
 

 
void instr_Vbias_to_be_set_function (void)
 The detector bias will be set at the value set with the function instr_detector_Vbias_we_want_to_set_function() with which the target values are stored in the vector Detector_bias_target[].
 
void instr_detector_scrittura_lettura_trimmer_bias_function (void)
 This is an instruction via CAN bus to read/write the detector trimmers. It calls the detector_scrittura_lettura_trimmer_bias(). A copy of the trimmers values is in the array contenuto_trimmer_detector[][].
 
void instr_Relays_driver_set_reset_channel_function (void)
 Function to set the relais for detector bias.
 
static void Detector_aggiusta_offset_SAR (EPROM_detector__ *EPROM_detector_sar, uint8_t scheda_su_scheda_giu_)
 
static void misura_il_valore_trimmer_detector (EPROM_detector__ *EPROM_detector_slope, uint8_t scheda_su_scheda_giu_, uint8_t canali_da_regolare, uint8_t trimmer_da_scrivere)
 
static bool Detector_verifica_Vbias (uint8_t scheda_su_giu, bool si_commuta)
 
void instruction_Detector_bias (void)
 The detector bias is set at the value passed from the CAN.
 
void imposta_il_trimmer_del_bias (int16_t *Valori_per_i_trimmer, long int discrepanza, int trimmer_bias_coarse_step_singolo, int trimmer_bias_fine_step_singolo)
 Trimmer settings for the function instruction_Detector_bias()
 
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().
 

Variables

volatile struct detector_SAR_ini_type Detector_SAR_ini []
 
int32_t Detector_bias_target []
 This is the detector bias target, not the bias set.
 
const struct Detector_coefficiente_type Detector_large_res_normalizing_factor []
 Large Load resistor, negative side, normalizing factor with repect to the positive resistors.
 
const struct Detector_coefficiente_type Detector_small_res_normalizing_factor []
 Small Load resistor, negative side, normalizing factor with repect to the positive resistors.
 
const struct Detector_coefficiente_type Detector_coarse_trimmer_normalizing_factor []
 Coarse trimmer, negative side, normalizing factor with repect to the positive side.
 
const int32_t Detector_positive_coarse_step_trimmer []
 
const int32_t Detector_positive_fine_step_trimmer []
 
const int32_t Detector_negative_coarse_step_trimmer []
 
const int32_t Detector_negative_fine_step_trimmer []
 
uint8_t detector_Relay_state []
 The state of the Detector realis is considerede. Note that this is the wanted working condition. The position of the relays could be unpredictable after a power cut.
 
int trimmer_bias_coarse_step_actual []
 
int trimmer_bias_fine_step_actual []
 
int Detector_Voltage_Bias []
 The bias voltage applied to the detectors.
 
struct detector_trimmer_type detector_Trimmer_bias [2]