PLC 交互
This commit is contained in:
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace DOAN.Infrastructure.PLC
|
||||
{
|
||||
public class PCLTool
|
||||
public class PLCTool
|
||||
{
|
||||
|
||||
|
||||
@@ -40,22 +40,18 @@ namespace DOAN.Infrastructure.PLC
|
||||
|
||||
|
||||
}
|
||||
public static int Write(string addr,int num)
|
||||
/// <summary>
|
||||
/// 写入bit
|
||||
/// </summary>
|
||||
/// <param name="addr"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static bool WriteBit(string addr,bool value)
|
||||
{
|
||||
|
||||
OperateResult write = siemensTcpNet.Write(addr, (byte)num);
|
||||
if (write.IsSuccess)
|
||||
{
|
||||
|
||||
Console.WriteLine("Write [v100] success");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Write [v100] failed: " + write.Message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
OperateResult write = siemensTcpNet.Write(addr, value);
|
||||
return write.IsSuccess;
|
||||
|
||||
}
|
||||
|
||||
public static void ConnectClose()
|
||||
Reference in New Issue
Block a user