CROSS Technical Documentation User Manual and Technical Doc.
INFN Milano Bicocca
Loading...
Searching...
No Matches
Trimmer.h
Go to the documentation of this file.
1
2#include <stdint.h>
3//#include "Memoria_pre_M24CXX.h"
4
5/// \file
6
7// #define preampli_fine_thermal_trimmer 0
8 #define preampli_JFET_Offset_trimmer 0
9 #define preampli_fine_offset_trimmer 1
10 #define preampli_coarse_thermal_trimmer 2
11 #define preampli_corse_offset_trimmer 3
12
13 #define commom_mode_trimmer_ch0 2
14 #define commom_mode_trimmer_ch1 3
15 #define transistor_cold_0 0
16 #define transistor_cold_1 1
17
18 #define coarse_Trimmer_offset_step (int)(1e6*(10.0*20.0/40.0/255*5.1/2.7*2))
19 #define fine_Trimmer_offset_step (int)((10.0*20.0/40.0/255*5.1/470*2)*1e6)
20 #define coarse_Trimmer_thermal_step (int)((2.4*20.0/40.0/255*5.1/2.7*2)*1e6)
21 #define fine_Trimmer_thermal_step (int)((2.4*20.0/40.0/255*5.1/470*2)*1e6)
22// #define JFET_Offset_coefficient (int) (1e6*10*20/40/255*(5.1*2/2.7+1)*2) /*187363 in microV*/
23 #define JFET_Offset_coefficient (int) (0.1293*1e6) /*in microV. Valore con l'introduzione del partitore che compensa */
24 /*la reiezione sull'alimentatore. Vedere matlab */
25 /*nella cartella della scheda anlogica: */
26 #define JFET_offset_conversione (int) (( coarse_Trimmer_offset_step *128) / JFET_Offset_coefficient ) /*Ricordarsi di dividere >> 7*/
27 #define coarse_Trimmer_drift_offset_ratio_by_2e7 (int)((coarse_Trimmer_thermal_step / coarse_Trimmer_offset_step) * 128)
28 #define reference_thermal_drift (int) (6645*20/40/255*5.1/2.7*2) /*6.645 mV/C is the measured drift of the 4 diodes*/
29 //I2C_B
30 #define I2C_addres_trimmer_bias_ch1 0x2C
31 #define I2C_addres_trimmer_bias_ch0 0x2D
32 #define I2C_addres_trimmer_common_mode_cold 0x2F
33 //I2C_A
34 #define I2C_addres_trimmer_pre_ch0 0x2D
35 #define I2C_addres_trimmer_pre_ch1 0x2F
36
37extern int coarse_Trimmer_offset_step_actual[];
38extern int fine_Trimmer_offset_step_actual[];
39extern int fine_Trimmer_thermal_step_actual[];
40extern int coarse_Trimmer_thermal_step_actual[];
41extern int reference_thermal_drift_actual;
42extern char numero_offset_per_impostazione_deriva[];
43#define massimo_numero_offset_per_impostazione_deriva 24
44extern char numero_temperature_impostazione_deriva[];
45#define massimo_numero_temperature_impostazione_deriva 16
46extern unsigned char coefficiente_termico_trimmer_deriva[];
47extern signed char valori_offset_per_impostazione_deriva[2][20];
48extern unsigned char valori_temperature_impostazione_deriva[2][12];
49extern char temperatura_di_lavoro[2];
50extern char offset_di_lavoro[];
51
52extern struct trimmer_type {
53// signed short fine_thermal;
54 signed short JFET_Offset;
55 signed short fine_offset;
56 signed short coarse_thermal;
57 signed short coarse_offset;
58} Trimmer_offset_preampli[];
59
60
62// signed short fine_thermal;
63 signed short JFET_COLD[2];
64 signed short CMRR[2];
65} Trimmer_CMRR_JFET_COLD;
66
67//Questo \'e il numero del primo trimmer per il cmrr
68#define Trimmer_numero_offset 2
69
70//Inizio CROSS
71//! \brief I2C address of the detecor trimmers
72#define I2C_address_ch_dispari 0x2E /*!< I2C address of detector bias trimmer 1, 3 and 5 */
73#define I2C_address_ch_pari 0x2F /*!< I2C address of detector bias trimmer 2, 4 and 6*/
74#define I2C_addres_trimmer_PGA 0x2C /*!< I2C address of the trimmers of the trimmer based PGA*/
75//! \brief Mask for command of the trimmer
76#define maschera_solo_bit_di_scrittura_trimmer 0x60 ///< only the 2 bits for trimmer selection are set
77//! \brief Settings for the digital sifgnals of the trimmer that manage the PGA relay
78
79#define trimmer_CMRR_compensation 0 /*!< '' */
80#define trimmer_fine_offset 1 /*!< '' */
81#define trimmer_thermal_compensation 2 /*!< '' */
82#define trimmer_coarse_offset 3 /*!< '' */
83#define trimmer_max_voltage_per_trimmer_calibration 3e6
84
85extern uint8_t contenuto_trimmer_detector[12][4];
86extern uint8_t volatile contenuto_trimmer_preamplifier[12][4];
87extern uint8_t volatile contenuto_trimmer_PGA_a_trimmer[][4];
88extern uint8_t volatile attenuatori_PGA_a_trimmer[];
89
90 /*! \brief Coordinates for the preamplifier and onboard EPROMs
91*\return No Parameters
92\showrefby
93\showrefs
94*\snippet{lineno} Trimmer.h fun_address_detector_bias_trimmer_type
95*/
96//! <!-- [fun_address_detector_bias_trimmer_type] -->
98 uint8_t quale_I2C; //<! One of the 4 the I2C mux
99 uint8_t indirizzo_I2C; //<! Device address
100};
101//! <!-- [fun_address_detector_bias_trimmer_type] -->
102
103extern const struct address_detector_bias_trimmer_type termometro_adrress[6]; //< Address of the memoies onboard, this is a 16k bits
104
106
108
110
112
113
114void detector_scrittura_lettura_trimmer_bias(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, uint8_t valore, uint8_t scrivi_leggi_1_leggi_0 );
115void preamplifier_scrittura_lettura_trimmer(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, uint8_t valore, uint8_t scrivi_leggi_1_leggi_0 );
118//Fine CROSS
119
120// Trimmer
121void Imposta_wiper_a_meta_scala_canale_0_I2C_A( void );
122void Imposta_wiper_a_meta_scala_canale_1_I2C_A( void );
123void Imposta_canale_del_trimmer_ennesimo_al_valore_I2CA (uint8_t numero_canale, uint8_t numero_trimmer, uint8_t valore_dato);
124void Imposta_wiper_a_meta_scala_canale_0_I2CB( void );
125void Imposta_wiper_a_meta_scala_canale_1_I2CB( void );
126void Imposta_canale_del_trimmer_ennesimo_al_valore_I2CB (uint8_t numero_canale, uint8_t numero_trimmer, uint8_t valore_dato);
127long int Arrotonda(float temp);
128//void Trova_valori_trimmer_per_la_Vbias_del_rivelatore_per_la_tensione_in_uscita_uguale_a_vout (long int vout, int16_t *Valori_per_i_trimmer, long int offset);
129void Trova_valori_trimmer_per_offset_preamplificatore (long int offset, struct trimmer_type *Valori_per_i_trimmer, int coarse_trimmer_step, int fine_trimmer_step);
130//Questo \'e il trimmer per il common mode
131void Imposta_trimmer_common_mode_I2CB ( uint8_t numero_trimmer, uint8_t valore_dato);
132
void instr_DetBias_trimmer_calibration_function(void)
The fine and coarse trimmers for Detector bias adjustment are calibrated here
Definition: Trimmer.c:480
void instr_offset_trimmer_calibration_function(void)
The fine and coarse trimmers for offset adjustment are calibrated here
Definition: Trimmer.c:320
const struct address_detector_bias_trimmer_type termometro_adrress[6]
Thermometer selection structure.
const struct address_detector_bias_trimmer_type address_PGA_a_trimmer[]
Preamplifier trimmer addresses
Definition: Trimmer.c:149
uint8_t contenuto_trimmer_detector[12][4]
Content of the trimmer for detector bias system.
Definition: Trimmer.c:161
uint8_t volatile contenuto_trimmer_PGA_a_trimmer[][4]
Definition: Trimmer.c:206
uint8_t volatile attenuatori_PGA_a_trimmer[]
Definition: Trimmer.c:217
const struct address_detector_bias_trimmer_type address_detector_bias_trimmer[]
Detector trimmer addresses.
Definition: Trimmer.c:129
void preamplifier_scrittura_lettura_trimmer(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, uint8_t valore, uint8_t scrivi_leggi_1_leggi_0)
Setting the value of any trimmer for preamplifier trimmer, the contents of the trimmers are stored in...
Definition: Trimmer.c:283
uint8_t volatile contenuto_trimmer_preamplifier[12][4]
Definition: Trimmer.c:179
const struct address_detector_bias_trimmer_type EPROM_address[]
This is the structure from which the I2C addressess and the I2C of the preamplifier and frontend boar...
const struct address_detector_bias_trimmer_type address_preamplifier_trimmer[]
Preamplifier trimmer addresses
Definition: Trimmer.c:139
void detector_scrittura_lettura_trimmer_bias(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t trimmer, uint8_t valore, uint8_t scrivi_leggi_1_leggi_0)
Setting the value of any trimmer for detector biasing, the contents of the trimmers are stored in the...
Definition: Trimmer.c:238
Coordinates for the preamplifier and onboard EPROMs.
Definition: Trimmer.h:97