From 51bd29feb290824d5094f701a7181725fcc71228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=94=84=E5=A4=B4?= Date: Thu, 27 Jun 2024 18:31:02 +0800 Subject: [PATCH] BoolDeg --- DataBlockHelper/DBHelpers/DB92Help.cs | 65 +++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/DataBlockHelper/DBHelpers/DB92Help.cs b/DataBlockHelper/DBHelpers/DB92Help.cs index afe7c85..5abd2f8 100644 --- a/DataBlockHelper/DBHelpers/DB92Help.cs +++ b/DataBlockHelper/DBHelpers/DB92Help.cs @@ -64,4 +64,69 @@ namespace DataBlockHelper.DBHelpers public float LowerPressure { get; set; } } + + + public class Db92DengHelp : DBHelper + { + public Db92DengHelp() + { + OperateResult db = PlcConnect.Instance.Read("DB92.0.0", 46); + bytes = db.Content; + } + + public BoolDeg DegA=>new BoolDeg(40,bytes); + public BoolDeg DegB => new BoolDeg(42, bytes); + public BoolDeg DegC => new BoolDeg(44, bytes); + + } + + public class BoolDeg + { + public BoolDeg(ushort startSet, byte[] bytes) + { + var trans = PlcConnect.Instance.ByteTransform; + byte[] content = bytes.Skip(startSet).Take(2).ToArray(); + + byte bte=content[0]; + A = bte.GetBit(0); + B = bte.GetBit(1); + C = bte.GetBit(2); + D = bte.GetBit(3); + E = bte.GetBit(4); + F = bte.GetBit(5); + G = bte.GetBit(6); + H = bte.GetBit(7); + bte=content[1]; + I = bte.GetBit(0); + J = bte.GetBit(1); + K = bte.GetBit(2); + L = bte.GetBit(3); + M = bte.GetBit(4); + N = bte.GetBit(5); + O = bte.GetBit(6); + } + + + public bool A { get; set; } + public bool B { get; set; } + public bool C { get; set; } + public bool D { get; set; } + public bool E { get; set; } + public bool F { get; set; } + public bool G { get; set; } + public bool H { get; set; } + public bool I { get; set; } + public bool J { get; set; } + public bool K { get; set; } + public bool L { get; set; } + public bool M { get; set; } + public bool N { get; set; } + public bool O { get; set; } + + } + + + } + +