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/Entity/DB2107Entity/LevelEntity.cs

78 lines
2.7 KiB
C#

using HslCommunication;
namespace DataBlockHelper.Entity.DB2107Entity
{
public class LevelEntity
{
public LevelEntity()
{
OperateResult<byte[]> read = PlcConnect.Instance.Read("DB2107.2060.0", 3);
var content = read.Content;
byte byt = content[0];
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);
byt = content[1];
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);
byt = content[2];
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);
}
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; }
}
}