PROGRAM Prog1
(* In order to enable the 5-meter sensor, jumper Digital Output 1 to Digital Input 1 *)
_IO_EM_DO_01 := TRUE;
cfg_5MeterSensor := _IO_EM_DI_01; 

IF cfg_5MeterSensor THEN
	cfg_MinScaled := 0.0;
	cfg_MaxScaled := 16.4042;
ELSE
	cfg_MinScaled := 0.0;
	cfg_MaxScaled := 34.6;
END_IF;


AIN_1_SCALER(ANY_TO_REAL(_IO_P1_AI_00), 13104.0, 65520.0, cfg_MinScaled, cfg_MaxScaled);
val_Level := AIN_1_SCALER.Output;

alarm_Hi := (val_Level >= cfg_HighAlarm) OR _IO_EM_DI_00;
alarm_Lo := val_Level <= cfg_LowAlarm;

_IO_EM_DO_00 := alarm_Hi OR alarm_Lo;
END_PROGRAM