You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB

6 months ago
namespace HybirdFrameworkDriver.ModbusTcpMaster;
public class ModbusProperty<T> : IModbusProperty
{
/// <summary>
/// 寄存器编号
/// </summary>
public int RegisterNo { get; set; }
/// <summary>
/// 数据起始地址
/// </summary>
public int Start { get; set; }
/// <summary>
/// 数据域长度
/// </summary>
public int Length { get; set; }
/// <summary>
/// 数据类型
/// </summary>
public ModbusDataType Type { get; set; }
public double Scale { get; set; }
public int Round { get; set; }
public double Offset { get; set; }
public T Value { get; set; }
public ModbusProperty(int registerNo, int start = 0, int length = 1, ModbusDataType type = ModbusDataType.Register,
double scale = 1,
int round = 0, double offset = 0)
{
this.RegisterNo = registerNo;
this.Start = start;
this.Length = length;
this.Type = type;
this.Scale = scale;
this.Round = round;
this.Offset = offset;
}
public int GetRegisterNo()
{
return RegisterNo;
}
}
public enum ModbusDataType
{
Bit,
Byte,
Register
}