spostamento dll x MTC e CMSCncLib...

This commit is contained in:
Samuele E. Locatelli
2017-05-12 09:34:43 +02:00
parent 2cbd457da7
commit 3078b2d41e
5 changed files with 54 additions and 11 deletions
+5 -1
View File
@@ -100,7 +100,7 @@
<ItemGroup>
<Reference Include="Siemens.Sinumerik.Operate.Services, Version=4.7.3.2, Culture=neutral, PublicKeyToken=bdd90fa02fd1c4ee, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\ExtLib\Siemens.Sinumerik.Operate.Services.dll</HintPath>
<HintPath>ExtLib\Siemens.Sinumerik.Operate.Services.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
@@ -631,6 +631,10 @@
</None>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="ExtLib\Siemens.Sinumerik.Operate.Services.dll" />
<Content Include="ExtLib\Siemens.Sinumerik.Operate.Services.Wrapper.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
+49 -10
View File
@@ -85,7 +85,10 @@ namespace MTC_Adapter
/// <param name="adpConf"></param>
public AdapterSiemens(MainForm caller, AdapterConf adpConf) : base(caller, adpConf)
{
lg.Info("Start init Adapter SIEMENS all'IP {0}", utils.CRS("ipPLC"));
// !!!HARD CODED!!! aggiunto banco STATUS del 2 processo IN CODA... (4+1)DW=20byte x strobes...!!!
Strobes = new byte[20];
lg.Info("Start init Adapter SIEMENS", utils.CRS("ipPLC"));
Runtime.CreateNC(CNC.NcType.SIEMENS, utils.CRS("ipPLC"));
@@ -190,17 +193,53 @@ namespace MTC_Adapter
base.getStrobeAndAckStatus();
if (connectionOk)
{
// leggo TUTTO ack e strobe,
byte[] MemBlock = new byte[Strobes.Length + Acknowl.Length];
int memIndex = 0;
// come OSAI
if (false)
{
#if false
// leggo TUTTO ack e strobe... in blocco di 16 WORD (32 byte) + altre 2 in coda...
ushort[] MemBlock_A = new ushort[16];
ushort[] MemBlock_B = new ushort[2];
inizio = DateTime.Now;
SIEMENSMemRW(R, baseMemDb, memIndex, ref MemBlock);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STROBES", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
int memIndexA = 19018;
int memIndexB = 19698;
// suddivido!
Buffer.BlockCopy(MemBlock, 0, Acknowl, 0, Acknowl.Length);
Buffer.BlockCopy(MemBlock, Acknowl.Length, Strobes, 0, Strobes.Length);
// NB: LEGGO SEMPRE a WORD 16bit (+ veloce...)
// leggo blocco dati + grande...
inizio = DateTime.Now;
OsaiMemRW_Word(R, OSAI.MemTypeWord.MW_CODE, memIndexA, ref MemBlock_A);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-{0}-W4", MemBlock_A.Length * 2), DateTime.Now.Subtract(inizio).Ticks);
// leggo blocco dati + piccolo
inizio = DateTime.Now;
OsaiMemRW_Word(R, OSAI.MemTypeWord.MW_CODE, memIndexB, ref MemBlock_B);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-{0}-W1", MemBlock_B.Length * 2), DateTime.Now.Subtract(inizio).Ticks);
// suddivido blocco a blocco... da file di conf x OSAI!!!
// primi 12 byte ad ACK
Buffer.BlockCopy(MemBlock_A, 0, Acknowl, 0, Acknowl.Length - 4);
// altri 4 byte ad ACK blocco secondario
Buffer.BlockCopy(MemBlock_B, 0, Acknowl, Acknowl.Length - 4, 4);
// tutti i 16+4 byte a strobe/status
Buffer.BlockCopy(MemBlock_A, Acknowl.Length - 4, Strobes, 0, Strobes.Length);
#endif
}
// come FANUC
else
{
// leggo TUTTO ack e strobe,
byte[] MemBlock = new byte[Strobes.Length + Acknowl.Length];
int memIndex = 0;
inizio = DateTime.Now;
SIEMENSMemRW(R, baseMemDb, memIndex, ref MemBlock);
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-STROBES", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks);
// suddivido!
Buffer.BlockCopy(MemBlock, 0, Acknowl, 0, Acknowl.Length);
Buffer.BlockCopy(MemBlock, Acknowl.Length, Strobes, 0, Strobes.Length);
}
}
else
{