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/DB1Entity/ForAnaLogOut.cs

35 lines
1.3 KiB
C#

using HslCommunication;
using System.Linq;
namespace DataBlockHelper.Entity.DB1Entity
{
public class ForAnaLogOut
{
public ForAnaLogOut(ushort startSet, byte[] bytes)
{
//OperateResult<byte[]> read = PlcConnect.Instance.Read("DB1." + startSet + ".0", 8);
var content = bytes.Skip(startSet).Take(20).ToArray();
ACT_VALUE = PlcConnect.Instance.ByteTransform.TransSingle(content, 0);
INPUT_MIN = PlcConnect.Instance.ByteTransform.TransSingle(content, 4);
INPUT_MAX = PlcConnect.Instance.ByteTransform.TransSingle(content, 8);
OUTPUT_MIN = PlcConnect.Instance.ByteTransform.TransInt16(content, 12);
OUTPUT_MAX = PlcConnect.Instance.ByteTransform.TransInt16(content, 14);
Output_Word = PlcConnect.Instance.ByteTransform.TransUInt16(content, 16);
byte byt = content[18];
ALARM = byt.GetBit(0);
}
public float ACT_VALUE { get; private set; }
public float INPUT_MIN { get; private set; }
public float INPUT_MAX { get; private set; }
public short OUTPUT_MIN { get; private set; }
public short OUTPUT_MAX { get; private set; }
public ushort Output_Word { get; private set; }
public bool ALARM { get; private set; }
}
}