/// <summary> /// Updates and converts the values from buffer /// </summary> /// <param name="sender">Connection class</param> /// <param name="e">EventArgs, Event argument</param> public void UpdateDataLimitSwitch(object sender, EventArgs e) { try { LimitStatus1 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(ModbusCommands.LVSLimitValueStatus)); LimitStatus2 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(ModbusCommands.LVSLimitValueStatus)); LimitStatus3 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(ModbusCommands.LVSLimitValueStatus)); LimitStatus4 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(ModbusCommands.LVSLimitValueStatus)); ApplicationMode _applicationMode = (ApplicationMode)Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.IMDApplicationMode)); if (_applicationMode == ApplicationMode.Standard) { _limitSwitch1Mode = StringToLimitSwitchMode(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchMode)); _limitSwitch1Source = StringToLimitSwitchSource(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchSource)); _limitSwitch1LevelAndLowerBandValue = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchLevel)); _limitSwitch1HysteresisAndBandHeight = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchHysteresis)); _limitSwitch2Mode = StringToLimitSwitchMode(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchMode)); _limitSwitch2Source = StringToLimitSwitchSource(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchSource)); _limitSwitch2LevelAndLowerBandValue = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchLevel)); _limitSwitch2HysteresisAndBandHeight = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchHysteresis)); _limitSwitch3Mode = StringToLimitSwitchMode(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchMode)); _limitSwitch3Source = StringToLimitSwitchSource(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchSource)); _limitSwitch3LevelAndLowerBandValue = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchLevel)); _limitSwitch3HysteresisAndBandHeight = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchHysteresis)); _limitSwitch4Mode = StringToLimitSwitchMode(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchMode)); _limitSwitch4Source = StringToLimitSwitchSource(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchSource)); _limitSwitch4LevelAndLowerBandValue = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchLevel)); _limitSwitch4HysteresisAndBandHeight = Convert.ToInt32(_connection.ReadFromBuffer(ModbusCommands.LIV1LimitSwitchHysteresis)); } } catch (KeyNotFoundException) { Console.WriteLine("KeyNotFoundException in class DataStandardModbus, update method"); } }
/// <summary> /// Updates and converts the values from buffer /// </summary> /// <param name="sender">Connection class</param> /// <param name="e">EventArgs, Event argument</param> public void UpdateDataIO(object sender, EventArgs e) { try { Input1 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.IS1DigitalInput1)); Input2 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.IS2DigitalInput2)); Input3 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.IS3DigitalInput3)); Input4 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.IS4DigitalInput4)); _output1 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.OS1DigitalOutput1)); _output2 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.OS2DigitalOutput2)); _output3 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.OS3DigitalOutput3)); _output4 = MeasurementUtils.StringToBool(_connection.ReadFromBuffer(JetBusCommands.OS4DigitalOutput4)); } catch (KeyNotFoundException) { Console.WriteLine("KeyNotFoundException in class DataStandardJet, update method"); } }