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

Go to the source code of this file.

Data Structures

struct  ADC_coefficiente_type
 
struct  coeffcienti_misura_ADC_type
 

Macros

#define ADC_communication_reg   0
 
#define ADC_to_be_added_to_read   0x40
 
#define ADC_data_reg   0x08
 
#define ADC_range_reg   0x28
 
#define ADC_Conversion_time_reg   0x30
 
#define ADC_mode_reg   0x38
 
#define ADC_mode_reg_ch0   0x38
 
#define ADC_mode_reg_ch1   ADC_mode_reg_ch0 + 2
 
#define ADC_channel_data_reg   0x08
 
#define ADC_full_scale_correction_register   0x18
 
#define ADC_offset_correction_register   0x10
 
#define ADC_channel_conversion_time_FW_ch0_register   0x30
 
#define ADC_channel_conversion_time_FW_ch1_register   ADC_channel_conversion_time_FW_ch0_register + 2
 
#define ADC_max_resolution   0xFF
 
#define ADC_ZeroScaleCalibration_com   0x82
 
#define ADC_Channel_zero_scale_calibration   12
 
#define ADC_Channel_full_scale_calibration   14
 
#define ADC_idle_com   0x02
 
#define ADC_mode_reg_set_single_24bit   0x42
 
#define read_from_CH0   0x48
 
#define read_from_CH1   (read_from_CH0+2)
 
#define ADC_numeratore_PGA   1
 
#define ADC_denominatore_PGA   10
 
#define ADC_numeratore_PreOut   91
 
#define ADC_denominatore_PreOut   410
 
#define ADC_numeratore_PowerSupply   91
 
#define ADC_denominatore_PowerSupply   410
 
#define ADC_numeratore_Vreg   33
 
#define ADC_denominatore_Vreg   328
 
#define ADC_numeratore_Bias_p   29
 
#define ADC_denominatore_Bias_p   4
 
#define ADC_numeratore_Bias   11
 
#define ADC_denominatore_Bias   41
 
#define ADC_numeratore_Res_fisse   10
 
#define ADC_denominatore_Res_fisse   41
 
#define ADC_molteplicita_node_to_read   6
 
#define ADC_power_down_com   0x70
 
#define ADC_idle   0
 
#define ADC_max_input_range_minus_10_to_10   0
 
#define indice_Vbias   0
 
#define indice_PoerSupply   1
 
#define indice_100_ohm   2
 
#define indice_10_Kohm   3
 
#define indice_Vbias_extern   4
 
#define indice_default   5
 
#define ADC_Conversion_time_chop_e_max_filter   0xFF
 
#define ADC_Conversion_time_500micros_per_conversion   0x96
 
#define ADC_Conversion_time_200micros_per_conversion   0x88
 
#define ADC_Conversion_time_80micros_per_conversion   0x82
 
#define ADC_reference_voltage   2.5e6 /*Voltage in microV*/
 
#define R_ref_10k   10e6 /* Resistance in mOhm*/
 
#define R_series_for_Vbias_extern   1800.0*18000.0/(1800.0+18000.0)*1000
 
#define R_series_for_Vbias   1500.0*8200.0/(1500.0+8200.0)*1000
 
#define R_series_for_PowerSupply   1e6
 
#define RADC_tot   8*Radc_internal
 
#define Coefficiente_Vref_Vbias   Rmultiplexer + R_series_for_Vbias
 
#define Coefficiente_Vmeas_Vbias   RADC_tot + Coefficiente_Vref_Vbias
 
#define Coefficiente_Vref_Vbias_extern   Rmultiplexer + R_series_for_Vbias_extern
 
#define Coefficiente_Vmeas_Vbias_extern   RADC_tot + Coefficiente_Vref_Vbias_extern
 
#define Coefficiente_Vref_PowerSupply   Rmultiplexer + R_series_for_PowerSupply
 
#define Coefficiente_Vmeas_PowerSupply   RADC_tot + Coefficiente_Vref_PowerSupply
 
#define Coefficiente_Vref_default   Rmultiplexer + 100e3
 
#define Coefficiente_Vmeas_deafult   RADC_tot + Coefficiente_Vref_default
 
#define Coefficiente_Vref_100_ohm   Rmultiplexer + 100e3
 
#define Coefficiente_Vmeas_100_ohm   RADC_tot + Coefficiente_Vref_100_ohm
 
#define Coefficiente_Vref_10k_ohm   Rmultiplexer + 10000e3
 
#define Coefficiente_Vmeas_10k_ohm   RADC_tot + Coefficiente_Vref_10k_ohm
 

Functions

void instr_ADC_LETTURA_function (void)
 All the posible nodes voltages can be read with this instruction. Either the internal or an external ADC can be used. The external ADC option will become obsolote at the time of installation.
 
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.
 
void ADC_Sleep_fun (uint8_t up_down)
 ADC is sent to sleep mode.
 
void ADC_selfcal_zero_scale (uint8_t up_down)
 ADC self-calibration. ADC needs to be pre-selected.
 
void ADC_Wakeup (uint8_t up_down)
 ADC Wakeup and 24 bits reading.
 
signed long int ADC_lettura_24bit (char ADC_0_o_1, uint8_t up_down, uint8_t cosa_fare)
 ADC Wakeup and 24 bits reading.
 
uint32_t ADC_lettura_registro (char ADC_0_o_1, uint8_t up_down, uint8_t registro_ch0)
 This function allows to read a whatver regsiter of the ADC.
 
void ADC_scrittura_registro (char ADC_0_o_1, uint8_t up_down, uint8_t registro_ch0, int32_t value_to_write)
 This function allows to read a whatver regsiter of the ADC.
 
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.
 
void ADC_sleep_ON_OFF (uint8_t up_down, uint8_t ON_OFF_NOP)
 ADC is set to sleep or awake.
 
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 differenziale1_single_0)
 This function sets the original gain when a few LSb have to be determined. The umber of bits is bit_to_go.
 
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)
 
void calibrazione_Resistenze_sterne_ADC (void)
 
int correzione_misura_ADC (char quali_coefficienti, int misura)
 
long long int divisione_di_gianlu (long long int Numeratore, long long int denominatore)
 The division operator on 32 or 64 bit, positive/negative integers.
 

Variables

int32_t volatile ADC_misura_fatta
 
int32_t volatile ADC_external_measurement
 
uint8_t volatile ADC_external_measured_node
 
const struct ADC_coefficiente_type ADC_coefficiente []
 Node normalizing coeficinets used in ADC_lettura_24bit()
 
volatile uint8_t ADC_sleep_off
 if 0 ADC in sleep when not working, ADC>1 ADC never sleep
 
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
 
unsigned int Radc_internal
 
unsigned int Rmultiplexer
 This is the multiplexer resistor and the series resistor connected in series to it.
 
unsigned char medie_ADC
 The number of averages done is 1 << medie_ADC, or 2^medie_ADC.
 
struct coeffcienti_misura_ADC_type coeffcienti_misura_ADC [5+1]
 
unsigned char coeffcienti_misura_ADC_nodi []