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/DBHelpers/DB120Help.cs

88 lines
2.2 KiB
C#

12 months ago
using HslCommunication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.DBHelpers
{
public class DB120Help: DBHelper
{
public DB120Help() {
OperateResult<byte[]> db120 = PlcConnect.Instance.Read("DB120.0.0", 64);
bytes = db120.Content;
}
public Uhd GetUhd => new Uhd();
}
public class Uhd
{
public Uhd()
{
}
public Uhd(byte[] content)
{
var trans = PlcConnect.Instance.ByteTransform;
A= trans.TransSingle(content, 0);
B = trans.TransSingle(content, 4);
C = trans.TransSingle(content, 8);
D = trans.TransSingle(content, 12);
E = trans.TransSingle(content, 16);
F = trans.TransSingle(content, 20);
G = trans.TransSingle(content, 24);
H = trans.TransSingle(content, 28);
I = trans.TransSingle(content, 32);
J = trans.TransSingle(content, 36);
K = trans.TransSingle(content, 40);
L = trans.TransSingle(content, 44);
M = trans.TransSingle(content, 48);
N = trans.TransSingle(content, 52);
O= trans.TransSingle(content, 56);
Delay1 = trans.TransUInt16(content, 60);
Delay2 = trans.TransUInt16(content, 62);
Delay3 = trans.TransUInt16(content, 64);
}
public float A { get; set; }
public float B { get; set; }
public float C { get; set; }
public float D { get; set; }
public float E { get; set; }
public float F { get; set; }
public float G { get; set; }
public float H { get; set; }
public float I { get; set; }
public float J { get; set; }
public float K { get; set; }
public float L { get; set; }
public float M { get; set; }
public float N { get; set; }
public float O { get; set; }
public ushort Delay1 { get; set; }
public ushort Delay2 { get; set; }
public ushort Delay3 { get; set; }
}
}