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

◆ ADC_misura_differenziale_single_ended()

static int32_t ADC_misura_differenziale_single_ended ( uint8_t  scheda_su_scheda_giu,
uint8_t  nodo_da_leggere,
uint8_t  differenziale_1_single_0 
)
static

This function performs a differential or single ended measurement on nodes.

Parameters
[in]scheda_su_scheda_giu: the board to consider
[in]nodo_da_leggere: the positive node to read (the negtive node is the positive plus an offset determined by the function)
[in]differenziale_1_single_0: information about the measurement to perform
Returns
No Parameters, the actual result is sent to the CAN bus output throught tx_data.
852static int32_t ADC_misura_differenziale_single_ended(uint8_t scheda_su_scheda_giu , uint8_t nodo_da_leggere, uint8_t differenziale_1_single_0 ){
853 int32_t ADC_misura_fatta_pos=0, ADC_misura_fatta_neg=0,risul_vof=0;
854 uint8_t offset;
855 {
856 ADC_misura_fatta_pos= ADC_lettura(scheda_su_scheda_giu, nodo_da_leggere, 2);
858 risul_vof=0;
859 }else{
860 risul_vof= (ADC_lettura_24bit( nodo_da_leggere,scheda_su_scheda_giu, 2) ) ;
861 }
862 ADC_misura_fatta_pos = ADC_compensazione_al_nodo(nodo_da_leggere,ADC_misura_fatta_pos, risul_vof);
863 }
864 if(differenziale_1_single_0){//PGA o Pre out neg
865 if( nodo_da_leggere <= node_voltage_PreOut_ch_5 ){
866 offset=6;
867 }else{
868 offset=1;
869 }
870 ADC_misura_fatta_neg = ADC_lettura(scheda_su_scheda_giu, nodo_da_leggere + offset, 2);
872 risul_vof=0;
873 }else{
874 risul_vof= (ADC_lettura_24bit( nodo_da_leggere+6,scheda_su_scheda_giu, 2) ) ;
875 }
876 ADC_misura_fatta_neg = ADC_compensazione_al_nodo(nodo_da_leggere+offset,ADC_misura_fatta_neg, risul_vof);
877 }else{
878 ADC_misura_fatta_neg=0;
879 }
880 return ADC_misura_fatta_pos = ADC_misura_fatta_pos - ADC_misura_fatta_neg;
881}
int ADC_compensazione_al_nodo(uint8_t line_to_read, int32_t lettura_ADC, int32_t lettura_offset)
This function allows to read a whatver regsiter of the ADC.
Definition: Adc.c:568
long int ADC_lettura_24bit(char line_to_read_to_select_ADCch0_ADCch1, uint8_t up_down, uint8_t cosa_fare)
ADC Wakeup and 24 bits reading.
Definition: Adc.c:433
static int32_t ADC_misura_differenziale_single_ended(uint8_t scheda_su_scheda_giu, uint8_t nodo_da_leggere, uint8_t differenziale_1_single_0)
This function performs a differential or single ended measurement on nodes.
Definition: Adc.c:852
int32_t ADC_lettura(uint8_t scheda_su_scheda_giu_, uint8_t node_to_read, uint8_t cosa_fare)
This function allows to read the voltage of any of the selectable nodes.
Definition: Adc.c:710
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
@ node_voltage_PreOut_ch_5
Node voltage selection of PreOut 12+5 board down.
Definition: Istruzioni.h:90

Definition at line 852 of file Adc.c.