diff --git a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs index 000e10c0..c52050db 100644 --- a/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs +++ b/LibNoDaveConnectionLibrary/PLCs/S7_xxx/MC7/Helper.cs @@ -107,7 +107,10 @@ public static object StringValueToObject(string Value, S7DataRowType DataType) else if (DataType == S7DataRowType.DINT) return Int32.Parse(Value.Replace("L#", "")); else if (DataType == S7DataRowType.REAL) - return float.Parse(Value.Replace('.',',')); + // Handle Max/Min REAL values accordingly (e.g., "-3.402823e+038" or "3.402823e+038") + return float.TryParse(Value.Replace(".", ","), out float result) + ? result + : Value.StartsWith("-") ? float.MinValue : float.MaxValue; else if (DataType == S7DataRowType.S5TIME) return Helper.GetTimespanFromS5TimeorTime(Value); else if (DataType == S7DataRowType.TIME)