ModbusRtuOverTcpReadFloatAsync 方法 (String, UInt16) |
命名空间: HslCommunication.ModBus
public override Task<OperateResult<float[]>> ReadFloatAsync( string address, ushort length )
MelsecMcNet melsec_net = new MelsecMcNet( "192.168.0.100", 6000 ); // 以下是简单的读取,没有仔细校验的方式 float[] d100_119 = (await melsec_net.ReadFloatAsync( "D100", 10 )).Content; // 如果需要判断是否读取成功 OperateResult<float[]> R_d100_119 = await melsec_net.ReadFloatAsync( "D100", 10 ); if (R_d100_119.IsSuccess) { float value_d100 = R_d100_119.Content[0]; float value_d102 = R_d100_119.Content[1]; float value_d104 = R_d100_119.Content[2]; float value_d106 = R_d100_119.Content[3]; float value_d108 = R_d100_119.Content[4]; float value_d110 = R_d100_119.Content[5]; float value_d112 = R_d100_119.Content[6]; float value_d114 = R_d100_119.Content[7]; float value_d116 = R_d100_119.Content[8]; float value_d118 = R_d100_119.Content[9]; } else { // failed }