|
|
|
|
using HslCommunication;
|
|
|
|
|
using HslCommunication.Profinet.Inovance;
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace DataBlockHelper.DBHelpers
|
|
|
|
|
{
|
|
|
|
|
public class DB139Helper: DBHelper
|
|
|
|
|
{
|
|
|
|
|
public DB139Helper()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
OperateResult<byte[]> db = PlcConnect.Instance.Read("DB139.0.0", 32);
|
|
|
|
|
bytes = db.Content;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<bool> LowLevel
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
List<bool> result = new List<bool>();
|
|
|
|
|
byte[] content = bytes.Skip(0).Take(2).ToArray();
|
|
|
|
|
var con = content[0];
|
|
|
|
|
result.Add(con.GetBit(0));
|
|
|
|
|
result.Add(con.GetBit(1));
|
|
|
|
|
result.Add(con.GetBit(2));
|
|
|
|
|
result.Add(con.GetBit(3));
|
|
|
|
|
result.Add(con.GetBit(4));
|
|
|
|
|
result.Add(con.GetBit(5));
|
|
|
|
|
result.Add(con.GetBit(6));
|
|
|
|
|
result.Add(con.GetBit(7));
|
|
|
|
|
con = content[1];
|
|
|
|
|
result.Add(con.GetBit(0));
|
|
|
|
|
result.Add(con.GetBit(1));
|
|
|
|
|
result.Add(con.GetBit(2));
|
|
|
|
|
result.Add(con.GetBit(3));
|
|
|
|
|
result.Add(con.GetBit(4));
|
|
|
|
|
result.Add(con.GetBit(5));
|
|
|
|
|
result.Add(con.GetBit(6));
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<bool> HowLevel
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
OperateResult<byte[]> db = PlcConnect.Instance.Read("M1023.0", 2);
|
|
|
|
|
|
|
|
|
|
List<bool> result = new List<bool>();
|
|
|
|
|
byte[] content = db.Content.ToArray();
|
|
|
|
|
var con = content[0];
|
|
|
|
|
result.Add(con.GetBit(0));
|
|
|
|
|
result.Add(con.GetBit(1));
|
|
|
|
|
result.Add(con.GetBit(2));
|
|
|
|
|
result.Add(con.GetBit(3));
|
|
|
|
|
result.Add(con.GetBit(4));
|
|
|
|
|
result.Add(con.GetBit(5));
|
|
|
|
|
result.Add(con.GetBit(6));
|
|
|
|
|
result.Add(con.GetBit(7));
|
|
|
|
|
con = content[1];
|
|
|
|
|
result.Add(con.GetBit(0));
|
|
|
|
|
result.Add(con.GetBit(1));
|
|
|
|
|
|
|
|
|
|
var bbbb=con.GetBit(2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db = PlcConnect.Instance.Read("M1202.0", 1);
|
|
|
|
|
content = db.Content.ToArray();
|
|
|
|
|
con = content[0];
|
|
|
|
|
|
|
|
|
|
result.Add(con.GetBit(0));
|
|
|
|
|
result.Add(con.GetBit(1));
|
|
|
|
|
result.Add(con.GetBit(2));
|
|
|
|
|
result.Add(con.GetBit(3));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Add(bbbb);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|