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.

73 lines
2.4 KiB
C#

10 months ago
using NewLife;
namespace WorkerSynReport.Plc;
5 months ago
public class LevelEntity
{
public LevelEntity(byte[] bytes)
{
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2060.0", 3);
10 months ago
5 months ago
var content = bytes.Skip(2060).Take(3).ToArray();
10 months ago
5 months ago
byte byt = content[0];
10 months ago
5 months ago
LowLevel_D1 = byt.GetBit(0);
HighLevel_D1 = byt.GetBit(1);
LowLevel_D2 = byt.GetBit(2);
HighLevel_D2 = byt.GetBit(3);
LowLevel_D3 = byt.GetBit(4);
HighLevel_D3 = byt.GetBit(5);
LowLevel_D4 = byt.GetBit(6);
HighLevel_D4 = byt.GetBit(7);
10 months ago
5 months ago
byt = content[1];
10 months ago
5 months ago
LowLevel_D5 = byt.GetBit(0);
HighLevel_D5 = byt.GetBit(1);
LowLevel_D6 = byt.GetBit(2);
HighLevel_D6 = byt.GetBit(3);
LowLevel_D7 = byt.GetBit(4);
HighLevel_D7 = byt.GetBit(5);
LowLevel_D8 = byt.GetBit(6);
HighLevel_D8 = byt.GetBit(7);
10 months ago
5 months ago
byt = content[2];
10 months ago
5 months ago
LowLevel_D9 = byt.GetBit(0);
HighLevel_D9 = byt.GetBit(1);
LowLevel_D10 = byt.GetBit(2);
HighLevel_D10 = byt.GetBit(3);
LowLevel_D11 = byt.GetBit(4);
HighLevel_D11 = byt.GetBit(5);
LowLevel_D12 = byt.GetBit(6);
HighLevel_D12 = byt.GetBit(7);
10 months ago
5 months ago
}
10 months ago
5 months ago
public bool LowLevel_D1 { get; private set; }
public bool HighLevel_D1 { get; private set; }
public bool LowLevel_D2 { get; private set; }
public bool HighLevel_D2 { get; private set; }
public bool LowLevel_D3 { get; private set; }
public bool HighLevel_D3 { get; private set; }
public bool LowLevel_D4 { get; private set; }
public bool HighLevel_D4 { get; private set; }
public bool LowLevel_D5 { get; private set; }
public bool HighLevel_D5 { get; private set; }
public bool LowLevel_D6 { get; private set; }
public bool HighLevel_D6 { get; private set; }
public bool LowLevel_D7 { get; private set; }
public bool HighLevel_D7 { get; private set; }
public bool LowLevel_D8 { get; private set; }
public bool HighLevel_D8 { get; private set; }
public bool LowLevel_D9 { get; private set; }
public bool HighLevel_D9 { get; private set; }
public bool LowLevel_D10 { get; private set; }
public bool HighLevel_D10 { get; private set; }
public bool LowLevel_D11 { get; private set; }
public bool HighLevel_D11 { get; private set; }
public bool LowLevel_D12 { get; private set; }
public bool HighLevel_D12 { get; private set; }
10 months ago
5 months ago
}