'<ADbasic Header, Headerversion 001.001>
'<Header End>
FUNCTION Call_AnIn(canal_AnIn,gain_AnIn,Amin_AnIn,Amax_AnIn,Umin_AnIn,Umax_AnIn) AS FLOAT
	
  DIM bits_AnIn AS LONG
  DIM Call_AnIn_Temp AS FLOAT
 		
  bits_AnIn = shift_left(LOG(gain_AnIn)/LOG(2),5) + canal_AnIn - 1

  set_mux(1,bits_AnIn)		
  sleep(60)
  start_conv(1)
  wait_eoc(1)
		
		
  Call_AnIn_Temp = (Analog_In_Max-Analog_In_Min)/65535*readadc(1)+Analog_In_Min		
  '		#ENDIF
  '		#IF SYSTEM_VALUE = GOLD_SYSTEM
  '			Call_AnIn_Temp = (Analog_In_Max-Analog_In_Min)/65535*ADC(canal_AnIn,gain_AnIn)+Analog_In_Min
  '		#ENDIF
  Call_AnIn = (Umax_Anin-Umin_Anin)/(Amax_AnIn-Amin_AnIn)*(Call_AnIn_Temp-Amin_AnIn)+Umin_AnIn
		
ENDFUNCTION
