OmronFinsNetWriteAsync 方法 (String, Boolean) |
向PLC中位软元件写入bool数组,返回是否写入成功,比如你写入D100,values[0]对应D100.0,地址格式为"D100.0","C100.0","W100.0","H100.0","A100.0"
Write the bool array to the PLC's median device and return whether the write was successful. For example, if you write D100, values [0] corresponds to D100.0
and the address format is "D100.0", "C100.0", "W100. 0 "," H100.0 "," A100.0 "
命名空间:
HslCommunication.Profinet.Omron
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public override Task<OperateResult> WriteAsync(
string address,
bool[] values
)
Public Overrides Function WriteAsync (
address As String,
values As Boolean()
) As Task(Of OperateResult)
public:
virtual Task<OperateResult^>^ WriteAsync(
String^ address,
array<bool>^ values
) override
abstract WriteAsync :
address : string *
values : bool[] -> Task<OperateResult>
override WriteAsync :
address : string *
values : bool[] -> Task<OperateResult>
参数
- address
- 类型:SystemString
要写入的数据地址 - values
- 类型:SystemBoolean
要写入的实际数据,可以指定任意的长度
返回值
类型:
TaskOperateResult返回写入结果
实现
IReadWriteNetWriteAsync(String, Boolean)IReadWriteNetWriteAsync(String, Boolean)示例 OmronFinsNet omronFinsNet = new OmronFinsNet( "192.168.1.110", 9600 );
omronFinsNet.Write( "D100.1", true );
omronFinsNet.Write( "D100.1", new bool[] { true, false, true, false } );
OperateResult write1 = omronFinsNet.Write( "D100.1", true );
if (write1.IsSuccess)
{
}
else
{
}
OperateResult write2 = omronFinsNet.Write( "D100.1", new bool[] { true, false, true, false } );
if (write2.IsSuccess)
{
}
else
{
}
参见