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.
lj_plc/DataBlockHelper/DBHelpers/DB139Helper.cs

97 lines
2.6 KiB
C#

11 months ago
using HslCommunication;
6 months ago
using HslCommunication.Profinet.Inovance;
11 months ago
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));
6 months ago
var bbbb=con.GetBit(2);
11 months ago
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));
6 months ago
result.Add(bbbb);
11 months ago
return result;
}
}
}
}