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

Managing of the thermometer on preamplifiers

SUMMARY:

User use of thermometer on preamplifiers



The thermometer is the LM73 tha has a 14-bits digital ouput via I2C bus. Its schematic is in figure Figure_I2C_mux. It has been developed one function ofr its managing: termometro_lettura() with input parameters: uint8_t scheda_su_scheda_giu, uint8_t canale, uint32_t *temperatura_in_microK , the ouput is the pointer to temperatura_in_microK

uint32_t temperatura_in_microK;
termometro_lettura( scheda_su_scheda_giu_provvisorio, canale_ , &temperatura_in_microK )
void termometro_lettura(uint8_t scheda_su_scheda_giu, uint8_t canale, uint32_t *temperatura_in_microK)
Read the termometer on preamplifier.

FigureLM73 1: LM73 scheme

br

Thermometer function



Thermometrs are sent into shut down mode at the startup by means of termometro_sht_down( uint8_t scheda_su_scheda_giu, uint8_t canale ).
Here is the reading thermometer function termometro_lettura():

79void termometro_lettura( uint8_t scheda_su_scheda_giu, uint8_t canale, uint32_t *temperatura_in_microK ){
80
81 //< registri termometro
82 #define reg_temperatura 0
83 #define reg_configuration 1
84 #define reg_control_status 4
85 //< Commands
86 #define Shut_down_and_one_shot_command_for_config_reg 0x84
87 #define Max_accuracy_command_for_control_reg 0x60
88 #define maschera_DAV 1
89
90 uint8_t comando1[]={reg_control_status,Max_accuracy_command_for_control_reg};
91 uint8_t comando2[]={reg_configuration, Shut_down_and_one_shot_command_for_config_reg};
92// uint8_t comando2[]={reg_configuration, 0};
93 uint8_t comando3[]={reg_temperatura};
94 uint8_t comando4[]={reg_control_status};
95 uint8_t lettura[2];
96
97
98//void I2C_mux_select_ch( uint8_t scheda_su_scheda_giu, I2C_mainboard,uint8_t canale_da_abilitare)
99 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, termometro_adrress[canale].quale_I2C);
100
101 I2C_mux -> MasterTransmit( termometro_adrress[canale].indirizzo_I2C, comando1, 2,false); //bestacuracy
102 while( I2C_mux -> GetStatus().busy); // White transmission complete
104 I2C_mux -> MasterTransmit( termometro_adrress[canale].indirizzo_I2C, comando2, 2,false); //onseshot meas
105 while( I2C_mux -> GetStatus().busy); // White transmission complete
106 Aspetta_tanti_ms(150);
108
109 lettura[0]=0;
110 uint8_t conta_err=0;
111 while( ((lettura[0] & maschera_DAV) == 0) && (conta_err<10) ){
112 I2C_mux -> MasterTransmit( termometro_adrress[canale].indirizzo_I2C, comando4 , 1,false); //lettura control reg per dato pronto
113 while( I2C_mux -> GetStatus().busy); // White transmission complete
115
116 I2C_mux -> MasterReceive( termometro_adrress[canale].indirizzo_I2C, lettura, 2,false); //Read back the temperature
117 while( I2C_mux -> GetStatus().busy);
118 conta_err ++;
119 }
120 if(conta_err >=10) ERROR_codifica_errore(scheda_su_scheda_giu ,error_address_I2C0_B , I2C_error_termometro_0 + canale, 1);
121
122 I2C_mux -> MasterTransmit( termometro_adrress[canale].indirizzo_I2C, comando3, 1,false); //read temperature
123 while( I2C_mux -> GetStatus().busy); // White transmission complete
125
126 I2C_mux -> MasterReceive( termometro_adrress[canale].indirizzo_I2C, lettura, 2,false); //Read back the temperature
127 while( I2C_mux -> GetStatus().busy);
128
129 *temperatura_in_microK = ((uint32_t)lettura[0] <<8 ) + (uint32_t) lettura[1] ;
130 *temperatura_in_microK = *temperatura_in_microK & 0x7FFF ;
131 *temperatura_in_microK = (*temperatura_in_microK >> 2 ) *31250; //Resilt in microK
132
133 I2C_mux_select_ch( scheda_su_scheda_giu, I2C_mainboard, I2C_mux_disabilita_tutto);
134
135}
volatile uint32_t Error_bad_operation
exploited to mark the errors
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.
@ I2C_error_termometro_0
termometro ch0
@ error_address_I2C0_B
Error register B for I2C0
void I2C_mux_select_ch(uint8_t scheda_su_scheda_giu, uint8_t mainboard_postmainboard, uint8_t canale_da_abilitare)
The I2C mux.
Definition: I2C_mux.c:100
#define I2C_mux_disabilita_tutto
i2C transmission/reception was bad
Definition: I2C_mux.h:24
const struct address_detector_bias_trimmer_type termometro_adrress[6]
Thermometer selection structure.
void Aspetta_tanti_ms(int millisecondi)
The timing function.
Definition: Timer.c:52


The selction of the thermometr needs 2 parameters: the I2C and its I2C address. These parameters are found in the const strucure termometro_adrress[6].
The I2C addresses are:


The codes for mamnaging the trimmer are: