You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.5 KiB
C#
90 lines
2.5 KiB
C#
using HslCommunication;
|
|
|
|
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));
|
|
result.Add(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));
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
}
|