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

Go to the source code of this file.

Macros

#define saturazione_positiva   (int) 4.5e6
 
#define saturazione_negativa   (int) -4.5e6
 
#define istruzione_codice   7
 
#define istruzione_byte_0   2
 
#define istruzione_byte_1   3
 
#define istruzione_byte_2   4
 
#define istruzione_byte_3   5
 
#define istruzione_byte_4_e_scelta_canale   6
 
#define byte_istr_dati_0   0
 
#define byte_istr_dati_1   1
 
#define byte_istr_dati_2   2
 
#define byte_istr_dati_3   3
 
#define instr_canale_1   1<<0
 instr_NO_operation has the value of zero and the follwoing instructions are increased by one at each step.
 
#define instr_canale_2   1<<1
 
#define instr_canale_3   1<<2
 
#define instr_canale_4   1<<3
 
#define instr_canale_5   1<<4
 
#define instr_canale_6   1<<5
 
#define instr_scheda_up   1<<7
 
#define instr_all_channels   instr_canale_1 | instr_canale_2 | instr_canale_3 | instr_canale_4 | instr_canale_5 | instr_canale_6
 
#define instr_scheda_down   0
 
#define write_trimmer   (1<<6)
 
#define board_up   (1<<7)
 
#define ADC_GND_con_10k   16 /* or 0x10 */
 instr_NO_operation has the value of zero and the follwoing instructions are increased by one at each step.
 
#define ADC_Vdig5V_micro_passed   17 /* or 0x11 */
 
#define ADC_Vcc   18 /* or 0x12 */
 
#define ADC_Vee   19 /* or 0x13 */
 
#define ADC_JFET_c_ch1_S2   20 /* or 0x14 cold electronics*/
 
#define ADC_PRE_term_ch1   21 /* or 0x15 */
 
#define ADC_ADC_PGA_pos_in_ch1   22 /* or 0x16 pre output*/
 
#define ADC_ADC_PGA_neg_in_ch1   23 /* or 0x17 pre out*/
 
#define ADC_Misura_bias_10_att_ch1_p   32 /* or 0x20 */
 mux 2
 
#define ADC_Misura_bias_10_att_ch1_n   33 /* or 0x21 */
 
#define ADC_Misura_bias_20_att_ch1_p   34 /* or 0x22 NOTE: used to measure external Vbol pos*/
 
#define ADC_Misura_bias_20_att_ch1_n   35 /* or 0x23 NOTE: used to measure external Vbol neg*/
 
#define ADC_CommonMode_ch1   36 /* or 0x24 */
 
#define ADC_CommonMode_ch2   37 /* or 0x25 */
 
#define ADC_ADC_PGA_pos_out_ch1   38 /* or 0x26 */
 
#define ADC_ADC_PGA_neg_out_ch1   39 /* or 0x27 */
 
#define ADC_Vdig5V_micro_in   48 /* or 0x30 floating? */
 mux 3
 
#define ADC_Vcc_in   49 /* or 0x31 floating? */
 
#define ADC_Vee_in   50 /* or 0x32 floating? */
 
#define ADC_Vref_pos_in   51 /* or 0x33 floating? */
 
#define ADC_Vref_neg_in   52 /* or 0x34 floating? */
 
#define ADC_PRE_term_ch2   53 /* or 0x35 */
 
#define ADC_ADC_PGA_pos_in_ch0   54 /* or 0x36 pre output*/
 
#define ADC_ADC_PGA_neg_in_ch0   55 /* or 0x37 pre out*/
 
#define ADC_Misura_bias_10_att_ch0_p   64 /* or 0x40 */
 mux 4
 
#define ADC_Misura_bias_10_att_ch0_n   65 /* or 0x41 */
 
#define ADC_Misura_bias_20_att_ch0_p   66 /* or 0x42 NOTE: Used to calibrate Rmul of ADC*/
 
#define ADC_Misura_bias_20_att_ch0_n   67 /* or 0x43 */
 
#define ADC_JFET_c_ch0_S1   68 /* or 0x44 cold electronics*/
 
#define ADC_JFET_c_ch0_S2   69 /* or 0x45 cold electronics*/
 
#define ADC_ADC_PGA_pos_out_ch0   70 /* or 0x46 */
 
#define ADC_ADC_PGA_neg_out_ch0   71 /* or 0x47 */
 

Enumerations

enum  node_voltage_pga {
  node_voltage_PGA_offset =0 , node_voltage_PGA_ch_0 = node_voltage_PGA_offset , node_voltage_PGA_ch_1 , node_voltage_PGA_ch_2 ,
  node_voltage_PGA_ch_3 , node_voltage_PGA_ch_4 , node_voltage_PGA_ch_5 , node_voltage_PGA_neg_ch_0 ,
  node_voltage_PGA_neg_ch_1 , node_voltage_PGA_neg_ch_2 , node_voltage_PGA_neg_ch_3 , node_voltage_PGA_neg_ch_4 ,
  node_voltage_PGA_neg_ch_5 , node_voltage_PGA_neg_ch_6
}
 Node voltages that can be read from an external ADC. More...
 
enum  node_voltage_PreOut {
  node_voltage_PreOut_offset =12 , node_voltage_PreOut_ch_0 =node_voltage_PreOut_offset , node_voltage_PreOut_ch_1 , node_voltage_PreOut_ch_2 ,
  node_voltage_PreOut_ch_3 , node_voltage_PreOut_ch_4 , node_voltage_PreOut_ch_5 , node_voltage_PreOut_neg_ch_0 ,
  node_voltage_PreOut_neg_ch_1 , node_voltage_PreOut_neg_ch_2 , node_voltage_PreOut_neg_ch_3 , node_voltage_PreOut_neg_ch_4 ,
  node_voltage_PreOut_neg_ch_5
}
 
enum  node_voltage_PowerSupply {
  node_voltage_PowSupp_offset = 24 , node_voltage_Vcc =node_voltage_PowSupp_offset , node_voltage_Vee , node_voltage_Vdig ,
  node_voltage_sense_Vreg_n , node_voltage_sense_Vreg_p , node_voltage_sense_GND
}
 
enum  parameters_to_set { set_value_for_wait_for_ADC_setting }
 
enum  instructions_position { instr_base , instr_ADC_LETTURA_mux_selection , instr_ADC_LETTURA_adc_line_selection }
 
enum  instructions_position_rele { instr_CONTROLLO_RELE_Rele_canale = 1 , instr_CONTROLLO_RELE_quale_rele , instr_CONTROLLO_RELE_che_fare }
 
enum  instructions_position_PGA { instr_PGA_GAIN_quale_canale = 1 }
 
enum  instructions_position_Vbias { instr_Vbias_set_quale_canale = 1 }
 
enum  instructions_position_temp { instr_preamplifier_temperature_meas_quale_canale = 1 }
 
enum  instructions_position_power { instr_Power_supply_ON_OFF_power_ON_OFF = 1 }
 
enum  power_ON_OFF { Power_OFF , Power_ON }
 
enum  instructions_position_shut_down { instr_Shut_Down_ON_OFF_Shut_Down_ON_OFF = 1 }
 
enum  instructions_position_Vbias_and_offset { instr_Vbias_and_OFFSET_SET_canale_0_1 = 1 }
 
enum  instructions_position_trimmer_setting { instr_Trimmer_setting_canale_e_cosa = 1 }
 
enum  shut_down_ON_OFF { instr_Shut_Down_ON_OFF_ShutDown_ON , instr_Shut_Down_ON_OFF_ShutDown_OFF }
 
enum  mux { mux_1 =1 , mux_2 , mux_3 , mux_4 }
 
enum  ADC_sel_line {
  adc_line_1 =1 , adc_line_2 , adc_line_3 , adc_line_4 ,
  adc_line_5 , adc_line_6 , adc_line_7 , adc_line_8
}
 
enum  Canale_per_rele {
  rele_S1 =1 , rele_S2 , rele_S3 , rele_K4 ,
  rele_K2
}
 
enum  Canale_per_rele_1 {
  rele_S4 =1 , rele_S5 , rele_S6 , rele_K5 ,
  rele_K3
}
 
enum  rele_stato_0_stato_1 { rele_stato_0 , rele_stato_1 }
 
enum  quale_canale { canale_0 , canale_1 }
 
enum  trimmer_set { canale_0_trimmer_2 , canale_0_trimmer_0 , canale_1_trimmer_2 , canale_1_trimmer_0 }
 

Functions

void instr_NO_operation_function (void)
 The NOP sends backs the fw version.
 
void instruction_lettura_ADC (void)
 ADC instrunction implementation with node selection.
 
void instruction_Some_parameters_to_set (void)
 Some usefull parematers can be set here.
 
void instruction_Misura_della_temperatura (void)
 The temperature from both preamplifier is read.
 
void Misura_della_temperatura (int *misura_temperatura_locale)
 
void instr_Shut_Down_ON_OFF_function (void)
 μ-controller power down ON/OFF
 
void instruction_Offset_compensation (void)
 Output offset voltage compensation.
 
void Detector_PGA_Rele (char discriminazione)
 
void aggiustamento_SAR (bool *saturazione_canale, int attesa, char *nodo_di_misura_1)
 When the preamplifier output is saturated we start with the standard SAR.
 
void offset_Adjust_core (char chi_aggiustiamo, int *valore_target_per_ch, char *nodo_di_misura_1, char *nodo_di_misura_2, int tolleranza, int *coarse_trimmer_step, int *fine_trimmer_step, unsigned int attesa, int *misura_finale)
 
void attiva_il_CMRR (char chi_aggiustiamo, char attivare_si_no)
 

Variables

int wait_for_ADC_setting
 This is the time elapsed before the ADC starts to measure after that the Mux has been set.
 
int valore_target_per_offset []