DB137Helper

dep_deliver
我叫锄头 12 months ago
parent 12c3e2c325
commit fe8587cf03

@ -80,7 +80,10 @@ namespace Mesnac.Action.ChemicalWeighing.Test
private void MCButton_Click(object sender, EventArgs e) private void MCButton_Click(object sender, EventArgs e)
{ {
var list= MReadHelp.Read(); DB137WriterHelper.AddSpeed(new List<float>()
{
1,2,3
});
new DB137Helper(); new DB137Helper();

@ -29,6 +29,10 @@ namespace DataBlockHelper.DBHelpers
tyb = bytes.Skip(1).Take(1).First(); tyb = bytes.Skip(1).Take(1).First();
SideBlowing03 = tyb.GetBit(0); SideBlowing03 = tyb.GetBit(0);
SpeedA = trans.TransSingle(bytes, 2);
SpeedB = trans.TransSingle(bytes, 6);
SpeedC = trans.TransSingle(bytes, 10);
} }
@ -46,5 +50,11 @@ namespace DataBlockHelper.DBHelpers
public bool SideBlowing02 { get; set; } public bool SideBlowing02 { get; set; }
public bool SideBlowing03 { get; set; } public bool SideBlowing03 { get; set; }
public float SpeedA { get; set; }
public float SpeedB { get; set; }
public float SpeedC { get; set; }
} }
} }

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataBlockHelper.DBHelpers
{
public class DB137WriterHelper
{
public static void AddSpeed(List<float> ls)
{
var siemensS7Net = PlcConnect.Instance;
int start = 2;
foreach (var item in ls)
{
string db = $"DB137.{start}.0";
siemensS7Net.Write(db,item);
start=start+4;
}
}
}
}

@ -53,6 +53,7 @@
<Compile Include="DBHelpers\DB120Help.cs" /> <Compile Include="DBHelpers\DB120Help.cs" />
<Compile Include="DBHelpers\DB120WriteHelp.cs" /> <Compile Include="DBHelpers\DB120WriteHelp.cs" />
<Compile Include="DBHelpers\DB137Helper.cs" /> <Compile Include="DBHelpers\DB137Helper.cs" />
<Compile Include="DBHelpers\DB137WriterHelper.cs" />
<Compile Include="DBHelpers\DB1Helper.cs" /> <Compile Include="DBHelpers\DB1Helper.cs" />
<Compile Include="DBHelpers\DB2102Helper.cs" /> <Compile Include="DBHelpers\DB2102Helper.cs" />
<Compile Include="DBHelpers\DB2103Helper.cs" /> <Compile Include="DBHelpers\DB2103Helper.cs" />

Loading…
Cancel
Save