DLT698OverTcpReadUInt16Async 方法 (String, UInt16) |
命名空间: HslCommunication.Instrument.DLT
public override Task<OperateResult<ushort[]>> ReadUInt16Async( string address, ushort length )
MelsecMcNet melsec_net = new MelsecMcNet( "192.168.0.100", 6000 ); // 以下是简单的读取,没有仔细校验的方式 ushort[] d100_109 = (await melsec_net.ReadUInt16Async( "D100", 10 )).Content; // 如果需要判断是否读取成功 OperateResult<ushort[]> R_d100_109 = await melsec_net.ReadUInt16Async( "D100", 10 ); if (R_d100_109.IsSuccess) { // success ushort value_d100 = R_d100_109.Content[0]; ushort value_d101 = R_d100_109.Content[1]; ushort value_d102 = R_d100_109.Content[2]; ushort value_d103 = R_d100_109.Content[3]; ushort value_d104 = R_d100_109.Content[4]; ushort value_d105 = R_d100_109.Content[5]; ushort value_d106 = R_d100_109.Content[6]; ushort value_d107 = R_d100_109.Content[7]; ushort value_d108 = R_d100_109.Content[8]; ushort value_d109 = R_d100_109.Content[9]; } else { // failed }