SiemensS7NetWriteAsync 方法 (String, Boolean) |
写入PLC的一个位,例如"M100.6","I100.7","Q100.0","DB20.100.0",如果只写了"M100"默认为"M100.0"
Write a bit of PLC, for example "M100.6", "I100.7", "Q100.0", "DB20.100.0", if only write "M100" defaults to "M100.0"
命名空间:
HslCommunication.Profinet.Siemens
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public override Task<OperateResult> WriteAsync(
string address,
bool value
)
Public Overrides Function WriteAsync (
address As String,
value As Boolean
) As Task(Of OperateResult)
public:
virtual Task<OperateResult^>^ WriteAsync(
String^ address,
bool value
) override
abstract WriteAsync :
address : string *
value : bool -> Task<OperateResult>
override WriteAsync :
address : string *
value : bool -> Task<OperateResult>
参数
- address
- 类型:SystemString
起始地址,格式为"M100.6", "I100.7", "Q100.0", "DB20.100.0" ->
Start address, format "M100.6", "I100.7", "Q100.0", "DB20.100.0" - value
- 类型:SystemBoolean
写入的数据,True或是False -> Writes the data, either True or False
返回值
类型:
TaskOperateResult是否写入成功的结果对象 -> Whether to write a successful result object
实现
IReadWriteNetWriteAsync(String, Boolean)示例
假设写入M100.0的位是否通断
SiemensS7Net siemens = new SiemensS7Net( SiemensPLCS.S1200, " 192.168.1.110" );
siemens.Write( "M100.0", true );
OperateResult write1 = siemens.Write( "M100.0", true );
if (write1.IsSuccess)
{
}
else
{
}
参见