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

◆ instruction_Detector_PGA_Rele()

void instruction_Detector_PGA_Rele ( void  )

This is a sub-function of the ADC instrunction. It is useful as it cane be used in other part of the program such as detector bias setting and offset adjustement.

Parameters
[in]sottoistruzioneis the selctring node according to the list at ADC_Mux_page
Returns
No Parameters, the actual result is sent to the CAN bus output throught tx_data.
495// int lettura_ADC( char sottoistruzione){
496// char ii;
497//// ATTIVA_CHIP_SELECTOR_MULTIPLEXER( (sottoistruzione >> 4) & 0x7); //the 4 MSb select the mux
498//// Line_select_in_the_mux( sottoistruzione & 0xF); //The 4 LSb select te mux line
499// Aspetta_tanti_ms(wait_for_ADC_setting); //Wait for nodes stabilization
500// risultato=0;
501// for( ii=0; ii <(1 << medie_ADC); ii++){
502// risultato += ADC_lettura_24bit(0,0,2); //Measurement is taken
503// }
504// risultato=risultato>>medie_ADC;
505
506//// Stampa_risultato_sul_CAN(risultato); //The result is composed in the CAN message, 4 MSB.
507//// ATTIVA_CHIP_SELECTOR_MULTIPLEXER( 0); //Disable all mux's
508// return risultato;
509// }

We manage the relais which take care of the deetector performances. The relay for the pre PGA gain x1 - x10 is managed here, too.

This instruction needs to know the gain to set and the channel to apply the setting. These informztion is at byte istruzione_byte_4_e_scelta_canale of the CAN message.

Returns
No Parameters, the actual result is sent to the CAN bus output throught tx_data.
525 uint8_t canale_;
526 for( canale_=0; canale_<6; canale_++){
527 PGA_set_reset_pre_PGA_gain ( scheda_su_scheda_giu, canale_, PGA_set_pre_pga_low_gain ) ;
528 }
529 }
530
531 void Detector_PGA_Rele( char discriminazione){
532 char chan=0, action=0;
533 porta_pin_def PGA_pre_gain;
534 if (discriminazione>=0x10) chan=1;
535 action= discriminazione & 0x0F;
536 if (action>=8){
537 //Pga pre gain set to 1 V/V or to 10 V/V
538 if (action ==8){
539 //pga pre gain =1
540 if (chan){
541 PGA_pre_gain=PGA_pre_gain_1_ch1;
542 }else{
543 PGA_pre_gain=PGA_pre_gain_1_ch0;
544 }
545 }else{
546 //pga pre gain =10
547 if (chan){
548 PGA_pre_gain=PGA_pre_gain_10_ch1;
549 }else{
550 PGA_pre_gain=PGA_pre_gain_10_ch0;
551 }
552 }
553 GPIO_PinWrite(PGA_pre_gain.porta_num, PGA_pre_gain.pin_num, 1); // Viene attivato il PGA_rele_cho_1
555 GPIO_PinWrite(PGA_pre_gain.porta_num, PGA_pre_gain.pin_num, 0); // Viene disattivato il PGA_rele_cho_1
557 }else {
558 // Working with detector relays
559 Funzione_per_attivare( chan, (1 << action));
560 }
561 }
void PGA_set_reset_pre_PGA_gain(uint8_t scheda_su_scheda_giu, uint8_t canale, uint8_t set_2_reset_1_idle_0)
Here the 2 digital signals from the trimmer are exploited to set the gain of the input stage of the P...
Definition: DAC_PGA.c:143
#define PGA_set_pre_pga_low_gain
Set the amplifier gain in front of the PGA to 1 V/V, it is left shifted once in the trimmer.
Definition: DAC_PGA.h:8
#define wait_time_for_rele_setting
[ref_spi_clock_for_relais]
void instruction_Detector_PGA_Rele(void)
This is a sub-function of the ADC instrunction. It is useful as it cane be used in other part of the ...
Definition: Istruzioni.c:524
void Aspetta_tanti_ms(int millisecondi)
The timing function.
Definition: Timer.c:52
Definition: Gpio.h:13

Definition at line 524 of file Istruzioni.c.