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