It sets the new gain irrespective of the offset.
443void PGA_GAIN_set(
char canale,
unsigned int guadagno_da_impostare){
446 signed char PGA_si_NO=1;
454 if ( (canale >> ii) & 1) {
455 if ( guadagno_da_impostare < gain_pre_PGA_x_2){
457 Detector_PGA_Rele( ( (ii<<4) | 8));
462 Detector_PGA_Rele( ( (ii<<4) | 9));
466 Detector_PGA_Rele( ( (ii<<4) | 8));
475 unsigned short PGA_code = ((fondo_scala_DAC_PGA *
guadagno_minimo_PGA) * PGA_si_NO / guadagno_da_impostare) ;
479 if ( (canale >> ii) & 1) {
482 local_pin_port=PGA_DAC_pin_select_ch1;
483 PGA_Gain_code[1]= PGA_code;
484 PGA_Gain_V_su_V[1]=guadagno_da_impostare;
487 local_pin_port=PGA_DAC_pin_select_ch0;
488 PGA_Gain_code[0]= PGA_code;
489 PGA_Gain_V_su_V[0]=guadagno_da_impostare;
492 SPIdrv->Uninitialize();
495 GPIO_PinWrite(local_pin_port.porta_num, local_pin_port.pin_num, 0);
497 SPItx_16_per_il_DAC( (PGA_code<<4) & 0x3FFF);
499 GPIO_PinWrite(local_pin_port.porta_num, local_pin_port.pin_num, 1);
502 SPIdrv->Uninitialize();
uint8_t massimo_guadagno_impostabile
uint8_t guadagno_minimo_PGA
void PGA_GAIN_set(char canale, unsigned int guadagno_da_impostare)
It sets the new gain irrespective of the offset.
#define istruzione_byte_3
void SPI_Inizialize_per_il_DAC(void)
SPI is initialized here for DAC. Remember to set the variable SPI_speed before the call....
void SPI_Inizialize(void)
SPI is initialized here. Its ise t at 8 bits and 100 KHz, as default.
void Aspetta_tanti_ms(int millisecondi)
The timing function.
volatile int8_t vettore_istruzioni[8]
This is a copy of the received 8 bytes from the CAN.