public override void readData(WSMBTControl wsmbtControl) { ushort startAddress = (ushort)RegisterValueList.Select(item => item.Address).Min(); ushort endAddress = (ushort)RegisterValueList.Select(item => item.Address).Max(); List <object> valueList = base.readRegisterRange(startAddress, endAddress, wsmbtControl).ToList(); for (int i = 0; i < RegisterValueList.Count; i++) { ((RegisterValue <short>)RegisterValueList[i]).Value = Convert.ToInt16(valueList[i]); } }
public override void readData(WSMBTControl wsmbtControl) { ushort startAddress = (ushort)RegisterValueList.Select(item => item.Address).Min(); ushort endAddress = (ushort)(startAddress + RegisterValueList.Count * 2); List <object> valueList = base.readRegisterRange(startAddress, endAddress, wsmbtControl).ToList(); for (int i = 0; i < RegisterValueList.Count * 2 - 2; i = i + 2) { float val = wsmbtControl.RegistersToFloat(Convert.ToInt16(valueList[i + 1]), Convert.ToInt16(valueList[i])); ((RegisterValue <float>)RegisterValueList[i / 2]).Value = val; } }