OmronFinsNetReadBool 方法 (String, UInt16) |
命名空间: HslCommunication.Profinet.Omron
OmronFinsNet omronFinsNet = new OmronFinsNet( "192.168.1.110", 9600 ); // 以下是简单的读取,没有仔细校验的方式 bool X1 = omronFinsNet.ReadBool( "D100.1" ).Content; bool[] X1_10 = omronFinsNet.ReadBool( "D100.1", 10 ).Content; // 如果需要判断是否读取成功 OperateResult<bool> R_X1 = omronFinsNet.ReadBool( "D100.1" ); if (R_X1.IsSuccess) { // success bool value = R_X1.Content; } else { // failed } OperateResult<bool[]> R_X1_10 = omronFinsNet.ReadBool( "D100.1", 10 ); if (R_X1_10.IsSuccess) { // success bool x1 = R_X1_10.Content[0]; bool x2 = R_X1_10.Content[1]; bool x3 = R_X1_10.Content[2]; bool x4 = R_X1_10.Content[3]; bool x5 = R_X1_10.Content[4]; bool x6 = R_X1_10.Content[5]; bool x7 = R_X1_10.Content[6]; bool x8 = R_X1_10.Content[7]; bool x9 = R_X1_10.Content[8]; bool xa = R_X1_10.Content[9]; } else { // failed }