Prima versione SCM-ESA che legge CORRETTAMENTE (4) assi!!!!
This commit is contained in:
@@ -53,6 +53,9 @@ StatusNumber=401
|
||||
; indirizzo di memoria del primo byte di scrittura dati
|
||||
CommandsAddress=SIMREAD[0]
|
||||
CommandsNumber=10
|
||||
; indirizzo di memoria AreaV DA CAPIRE/VERIFICARE!!!!
|
||||
VAreaAddress=V
|
||||
VAreaNumber=10
|
||||
; offset del registro per l'indice di collisione
|
||||
CollisionIndex=6.L
|
||||
; ritardo nella lettura dal plc
|
||||
|
||||
@@ -100,20 +100,214 @@ namespace MTC_Adapter
|
||||
public override void getStrobeAndAckStatus()
|
||||
{
|
||||
base.getStrobeAndAckStatus();
|
||||
#if false
|
||||
if (connectionOk)
|
||||
{
|
||||
// leggo TUTTO il blocco di memoria
|
||||
inizio = DateTime.Now;
|
||||
ncDevice.ReadBuffer();
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-PLC_MemoryRead", ncDevice.PLC_MemoryRead.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// tengo tutto nella memoria dell'oggetto ESA...
|
||||
//Buffer.BlockCopy(ncDevice.PLC_MemoryRead, 0, Strobes, 0, Strobes.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Errore connessione mancante in getStrobeAndAckStatus");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Buffer.BlockCopy(ncDevice.PLC_MemoryRead, 0, Strobes, 0, Strobes.Length);
|
||||
public override void getGlobalData()
|
||||
{
|
||||
base.getGlobalData();
|
||||
|
||||
// accodo dati path in DataMonitor......
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (connectionOk)
|
||||
{
|
||||
// leggo TUTTO il blocco di memoria
|
||||
inizio = DateTime.Now;
|
||||
ncDevice.ReadBuffer();
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R-PLC_MemoryRead", ncDevice.PLC_MemoryRead.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
}
|
||||
else
|
||||
{
|
||||
lg.Error("Errore connessione mancante in getStrobeAndAckStatus");
|
||||
}
|
||||
|
||||
|
||||
|
||||
parentForm.dataMonitor = sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processo stti macchina...
|
||||
/// </summary>
|
||||
public override void processStatus()
|
||||
{
|
||||
base.processStatus();
|
||||
|
||||
// HARD CODE: forzo path 1 (indice 0...)
|
||||
int idxPath = 0;
|
||||
|
||||
// switch su run mode...
|
||||
/*
|
||||
* MODO_X V[74].W
|
||||
* 0 = Modo NESSUNO
|
||||
* 1 = Modo MANUALE
|
||||
* 2 = Modo AUTOMATICO
|
||||
* 3 = Modo POM
|
||||
* 4 = Modo MDI
|
||||
* 5 = Modo SEMIAUTOMATICO
|
||||
* 6 = Modo RAP
|
||||
* 7 = Modo TES
|
||||
* */
|
||||
|
||||
uint Modo_X = ncDevice.PLC_MemoryAreaV[6];
|
||||
switch (Modo_X)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#if false
|
||||
if (STRB_DW2.HasFlag(StFlag32.B01))
|
||||
{
|
||||
vettPath[idxPath].mPathRunMode.Value = "AUTO";
|
||||
}
|
||||
else if (STRB_DW2.HasFlag(StFlag32.B02))
|
||||
{
|
||||
vettPath[idxPath].mPathRunMode.Value = "EDIT";
|
||||
}
|
||||
else if (STRB_DW2.HasFlag(StFlag32.B03))
|
||||
{
|
||||
vettPath[idxPath].mPathRunMode.Value = "MDI";
|
||||
}
|
||||
else if (STRB_DW2.HasFlag(StFlag32.B04))
|
||||
{
|
||||
vettPath[idxPath].mPathRunMode.Value = "REF";
|
||||
}
|
||||
else if (STRB_DW2.HasFlag(StFlag32.B05))
|
||||
{
|
||||
vettPath[idxPath].mPathRunMode.Value = "JOG";
|
||||
}
|
||||
else if (STRB_DW2.HasFlag(StFlag32.B07))
|
||||
{
|
||||
vettPath[idxPath].mPathRunMode.Value = "JOGINC";
|
||||
}
|
||||
else if (STRB_DW2.HasFlag(StFlag32.B07))
|
||||
{
|
||||
vettPath[idxPath].mPathRunMode.Value = "HANDLE";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void getUnOp()
|
||||
{
|
||||
base.getUnOp();
|
||||
}
|
||||
|
||||
public override void getPath()
|
||||
{
|
||||
base.getPath();
|
||||
}
|
||||
|
||||
public override void getAxis()
|
||||
{
|
||||
base.getAxis();
|
||||
|
||||
// mostro assi in DataMonitor......
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// nuova posizione (per calcoli)
|
||||
double newPos = 0;
|
||||
double distPerc = 0;
|
||||
int newDir = 0;
|
||||
|
||||
// leggo in modo "cablato" i dati dei vari assi...
|
||||
for (int i = 0; i < currAdpConf.nAxis; i++)
|
||||
{
|
||||
|
||||
// in base a indice scelgo valore posizione e load
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[240]), 0);
|
||||
//BitConverter.ToUInt16(ncDevice.PLC_MemoryRead, 240);
|
||||
break;
|
||||
case 1:
|
||||
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[241]), 0);
|
||||
break;
|
||||
case 2:
|
||||
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[242]), 0);
|
||||
break;
|
||||
case 3:
|
||||
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[243]), 0);
|
||||
break;
|
||||
case 4:
|
||||
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[244]), 0);
|
||||
break;
|
||||
case 5:
|
||||
newPos = (double)BitConverter.ToInt32(BitConverter.GetBytes(ncDevice.PLC_MemoryRead[245]), 0);
|
||||
break;
|
||||
default:
|
||||
// valPos = posAssi.p1;
|
||||
// valLoad = loadAssi.svload1;
|
||||
break;
|
||||
}
|
||||
|
||||
// popolo valori...
|
||||
//vettAxis[i].mAxLoad.Value = (double)(valLoad.data) / Math.Pow(10, valLoad.dec);
|
||||
vettAxis[i].mAxPosAct.Value = newPos;
|
||||
//vettAxis[i].mAxPosTgt.Value = newPos + (double)(valPos.dist.data) / Math.Pow(10, valPos.dist.dec);
|
||||
|
||||
if (utils.CRB("verbose"))
|
||||
{
|
||||
sb.AppendLine(string.Format("Asse {0}: PosAct:{1:N3}, ToGo:{2:N3}{3}", i, (double)(newPos) / utils.CRI("fattdecimale"), i, 0));
|
||||
}
|
||||
|
||||
vettAxis[i].mAxFeedAct.Value = FeedRate;
|
||||
|
||||
// calcolo distanza e salvo valore...
|
||||
distPerc = newPos - prevPosAxis[i];
|
||||
vettAxis[i].mAxDistDone.Value = Math.Abs(distPerc);
|
||||
|
||||
// sistemo direzione +/- (POS/NEG se lineari, CCW/CW se rotativi)
|
||||
if (distPerc != 0)
|
||||
{
|
||||
newDir = Convert.ToInt32(distPerc / Math.Abs(distPerc));
|
||||
}
|
||||
else
|
||||
{
|
||||
newDir = prevDirAxis[i];
|
||||
}
|
||||
vettAxis[i].mAxDir.Value = newDir;
|
||||
|
||||
// se la direzione è variata salvo il cambio direzione...
|
||||
if (newDir != prevDirAxis[i])
|
||||
{
|
||||
// salvo "+1" come cambi direzione
|
||||
vettAxis[i].mAxInvDDone.Value = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// salvo "0"...
|
||||
vettAxis[i].mAxInvDDone.Value = 0;
|
||||
}
|
||||
|
||||
// salvo valori vettore prec...
|
||||
prevPosAxis[i] = newPos;
|
||||
prevDirAxis[i] = newDir;
|
||||
|
||||
//vettAxis[i].mAxMainProc.Value = AxData.AxisMainProc;
|
||||
//vettAxis[i].mAxIsMaster.Value = AxData.AxisIsMaster;
|
||||
//vettAxis[i].mAxMastId.Value = AxData.AxisMastId;
|
||||
//vettAxis[i].mAxFeedOver.Value = AxData.AxisFeedOver;
|
||||
//vettAxis[i].mAxAccelAct.Value = AxData.AxisAccel;
|
||||
//vettAxis[i].mAxAccTime.Value = AxData.AxisAccTime;
|
||||
//vettAxis[i].mAxBattery.Value = AxData.AxisBattery;
|
||||
}
|
||||
|
||||
parentForm.dataMonitor += sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
OK 00) chiusura app --> FANUC_ref.disconnect
|
||||
OK 01) rivedere GetBit (cambiare!!!)
|
||||
OK 02) strobe allarmi --> su cambio fronte --> serve vettore stato COMPLETO allarmi
|
||||
OK 03) lo strobe allarmi va inizializzato all'avvio (carica TUTTI i bit...)
|
||||
OK 04) da strobe allarmi --> vettore allarmi
|
||||
OK 05) CodS 5 cifre
|
||||
OK 06) CodM/CodT 3 cifre
|
||||
07) lettura assi: posizioni, velocità, ...
|
||||
- feedrate C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\CMS_orig\A02B-0207-K737_04.20\Document\SpecE\Position\cnc_actf.htm
|
||||
- ALL? C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\CMS_orig\A02B-0207-K737_04.20\Document\SpecE\Position\cnc_rdaxisdata.htm
|
||||
OK 08) lettura strobe e registrazione NUOVO flusso EVENT x START/STOP/RESET (1 solo con 3 strobe separati) --> gestire!!!
|
||||
OK 09) update gestione SUB MODE
|
||||
OK 10) riallineamento simulatore generico
|
||||
11) spostare lettura spindle in mandrino/UnOp
|
||||
12) completare letture assi
|
||||
OK 13) completare gestione BIT di semaforo
|
||||
OK 14) completare gestione strobe (x i bit "non qualificati")
|
||||
OK 15) decodifica corretta livello allarme (WARNING/FAULT)
|
||||
16) lettura codici G del path con cnc_rdgcode
|
||||
17) lettura dati "globali" in un unico ciglo (rdyndata2)
|
||||
18) lettura speed dei mandrini (UnOp) da memorie (D3140 --> D3178, 2 byte 16bit UINT16, sono RPM interi, max 20 teste...)
|
||||
19) calcolo distanze percorse assi
|
||||
20) calcolo numero inversioni assi
|
||||
21) revisione file conf ADAPTER
|
||||
|
||||
|
||||
99) completamento funzioni con librerie fanuc native
|
||||
C:\Users\samuele.STEAMWAREWIN\Documents\VisualStudioProjects\CMS_orig\A02B-0207-K737_04.20\Document\SpecE\flist_com.htm
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SIM IP statico
|
||||
192.168.139.100
|
||||
|
||||
Mio IP statico
|
||||
192.168.139.101
|
||||
@@ -104,6 +104,13 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Analisi tempi.txt" />
|
||||
<Content Include="Appunti\SCM\Appunti doc CFG.txt" />
|
||||
<Content Include="Appunti\SCM\Appunti SCM.txt" />
|
||||
<Content Include="Appunti\SCM\Demo MonitorVariabili.avi" />
|
||||
<Content Include="Appunti\SCM\Demo ProView.avi" />
|
||||
<Content Include="Appunti\SCM\README.txt" />
|
||||
<Content Include="Appunti\SCM\Tutorial Metodi Lettura SeF.avi" />
|
||||
<Content Include="Appunti\SCM\VariabiliContatori.txt" />
|
||||
<Content Include="Resurces\CMS.ico" />
|
||||
<Content Include="dump\dump.exe">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
@@ -119,6 +126,8 @@
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Appunti\SCM\KvaraDb.doc" />
|
||||
<None Include="Appunti\SCM\KvaraDb.pdf" />
|
||||
<None Include="dump\build.bat" />
|
||||
<None Include="dump\dump.c" />
|
||||
<None Include="dump\dump.obj" />
|
||||
@@ -169,7 +178,7 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="AlarmListFANUC.txt" />
|
||||
<Content Include="Appunti.txt" />
|
||||
<Content Include="Appunti\CMS\Appunti CMS.txt" />
|
||||
<Content Include="HaltTypeList.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
@@ -38,9 +38,6 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="XSimGph">
|
||||
<HintPath>..\..\..\..\..\..\..\Kvara\Exe\XSimGph.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="XSimMem">
|
||||
<HintPath>..\..\..\..\..\..\..\Kvara\Exe\XSimMem.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using XSimGph;
|
||||
using IniFiles;
|
||||
|
||||
namespace SCMCncLib
|
||||
@@ -18,8 +17,8 @@ namespace SCMCncLib
|
||||
// !!! 2016.05.25 commentato e riscritto perchè NON C'E' la parte form, è DLL comunicazione...
|
||||
#if false
|
||||
protected XSimMainWindow m_form; // link to main window
|
||||
#endif // false
|
||||
protected MWEngine mwEngine; // link to graphic engine
|
||||
#endif // false
|
||||
public bool Connected = false;
|
||||
protected bool requestStop = false;
|
||||
protected int PlcDelay;
|
||||
@@ -58,27 +57,16 @@ namespace SCMCncLib
|
||||
// set delay for execution cycle
|
||||
PlcDelay = fIni.ReadInteger("NC", "PlcDelay", 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialization: common operations for all devices.
|
||||
/// </summary>
|
||||
/// <param name="e">The e.</param>
|
||||
/// <param name="fIni">The f ini.</param>
|
||||
public thdNcBase(MWEngine e, IniFile fIni)
|
||||
{
|
||||
// store link to graphic manager
|
||||
mwEngine = e;
|
||||
// set delay for execution cycle
|
||||
PlcDelay = fIni.ReadInteger("NC", "PlcDelay", 10);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initialize read and write buffers of memory manager
|
||||
/// </summary>
|
||||
public void CreateBuffers()
|
||||
{
|
||||
mwEngine.MemoryManager.InitializeMemories();
|
||||
}
|
||||
#if false
|
||||
mwEngine.MemoryManager.InitializeMemories();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request to stop the thread
|
||||
|
||||
@@ -5,7 +5,6 @@ using System.Threading;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using XSimGph;
|
||||
using IniFiles;
|
||||
|
||||
namespace SCMCncLib
|
||||
@@ -34,6 +33,9 @@ namespace SCMCncLib
|
||||
{
|
||||
private UInt16 ReadNumber;
|
||||
private UInt16 WriteNumber;
|
||||
private UInt16 VAreaNumber;
|
||||
private UInt16 ETKAreaNumber;
|
||||
|
||||
|
||||
private string SysLink = "";
|
||||
private string DefCn = "";
|
||||
@@ -46,9 +48,15 @@ namespace SCMCncLib
|
||||
private string CommandsAddressName;
|
||||
private TS_REG CommandsAddress;
|
||||
|
||||
private string VAreaAddressName;
|
||||
private TS_REG VAreaAddress;
|
||||
|
||||
public UInt32[] PLC_MemoryRead;
|
||||
public UInt32[] PLC_MemoryWrite;
|
||||
|
||||
public UInt32[] PLC_MemoryAreaV;
|
||||
public UInt32[] PLC_MemoryAreaETK;
|
||||
|
||||
// esa constants
|
||||
#region ESA_PLC_CONSTANTS
|
||||
private const UInt32 MAX_PATH = 256;
|
||||
@@ -137,9 +145,10 @@ namespace SCMCncLib
|
||||
|
||||
|
||||
// !!! 2016.05.25 inutile forse? riguarda l'engine 3d...
|
||||
//hack: metto 16...
|
||||
int ReadNumber = 16;
|
||||
int WriteNumber = 16;
|
||||
//hack: metto fisso...
|
||||
ReadNumber = 265;
|
||||
WriteNumber = 265;
|
||||
WriteNumber = 265;
|
||||
#if false
|
||||
// store read and write number of bytes
|
||||
ReadNumber = Convert.ToUInt16(mwEngine.MemoryManager.NrByteToRead / 4);
|
||||
@@ -151,72 +160,22 @@ namespace SCMCncLib
|
||||
|
||||
StatusAddressName = fIni.ReadString("NC", "StatusAddress", "SIMWRITE[0]");
|
||||
CommandsAddressName = fIni.ReadString("NC", "CommandsAddress", "SIMREAD[0]");
|
||||
VAreaAddressName= fIni.ReadString("NC", "VAreaAddress", "SIMREAD[0]");
|
||||
|
||||
// create read buffer
|
||||
PLC_MemoryRead = new UInt32[ReadNumber];
|
||||
// create write buffer
|
||||
PLC_MemoryWrite = new UInt32[WriteNumber];
|
||||
|
||||
if (!Connect())
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="thdNcEsaGvKvara"/> class.
|
||||
/// </summary>
|
||||
/// <param name="e">The e.</param>
|
||||
/// <param name="fIni">The f ini.</param>
|
||||
public thdNcEsaGvKvara(MWEngine e, IniFile fIni) : base(e, fIni)
|
||||
{
|
||||
DeviceType = NC_DEVICE_TYPE.ESAGV_KVARA;
|
||||
|
||||
StringBuilder tempS = new StringBuilder(Convert.ToInt32(MAX_PATH));
|
||||
|
||||
//string buffer = " ";
|
||||
//byte[] byteS = new UTF8Encoding().GetBytes(buffer);
|
||||
//GCHandle bufferH = GCHandle.Alloc(byteS, GCHandleType.Pinned);
|
||||
//IntPtr tempS = Marshal.UnsafeAddrOfPinnedArrayElement(byteS, 0);
|
||||
//byte[] tempS = new byte[MAX_PATH];
|
||||
|
||||
// set executable path
|
||||
SetDllDirectory(fIni.ReadString("NC", "SysExe", "C:\\KVARA\\EXE"));
|
||||
|
||||
// communication type
|
||||
string defValue = fIni.ReadString("NC", "SysLink", "SIMULATO");
|
||||
ENVGetProfileString("SYS", "LINK", defValue, tempS, MAX_PATH);
|
||||
//bufferH.Free();
|
||||
SysLink = tempS.ToString();
|
||||
|
||||
// communication channel
|
||||
iChannel = ConvComunicationChannel(SysLink);
|
||||
// definition path
|
||||
defValue = fIni.ReadString("NC", "SysDefCn", "C:\\KVARA\\DISCOI");
|
||||
ENVGetProfileString("SYS", "DEFCN", defValue, tempS, MAX_PATH);
|
||||
DefCn = tempS.ToString() + "\\defcn";
|
||||
//StrCat(DefCn, "\\defcn");
|
||||
|
||||
|
||||
// !!! 2016.05.25 inutile forse? riguarda l'engine 3d...
|
||||
|
||||
// store read and write number of bytes
|
||||
ReadNumber = Convert.ToUInt16(mwEngine.MemoryManager.NrByteToRead / 4);
|
||||
if (mwEngine.MemoryManager.NrByteToRead != ReadNumber * 4) ReadNumber++;
|
||||
WriteNumber = Convert.ToUInt16(mwEngine.MemoryManager.NrByteToWrite / 4);
|
||||
if (mwEngine.MemoryManager.NrByteToWrite != WriteNumber * 4) WriteNumber++;
|
||||
|
||||
|
||||
StatusAddressName = fIni.ReadString("NC", "StatusAddress", "SIMWRITE[0]");
|
||||
CommandsAddressName = fIni.ReadString("NC", "CommandsAddress", "SIMREAD[0]");
|
||||
|
||||
// create read buffer
|
||||
PLC_MemoryRead = new UInt32[ReadNumber];
|
||||
// create write buffer
|
||||
PLC_MemoryWrite = new UInt32[WriteNumber];
|
||||
// create VArea buffer
|
||||
PLC_MemoryAreaV = new UInt32[32];
|
||||
// create ETKArea buffer
|
||||
PLC_MemoryAreaETK = new UInt32[32];
|
||||
|
||||
if (!Connect())
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="thdNcEsaGvKvara"/> class.
|
||||
@@ -274,6 +233,36 @@ namespace SCMCncLib
|
||||
#endif // false
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Thread main execution
|
||||
/// </summary>
|
||||
public override void Execute()
|
||||
{
|
||||
while (!requestStop)
|
||||
{
|
||||
if (Connected)
|
||||
{
|
||||
// load data from NC
|
||||
ReadBuffer();
|
||||
// if requested make a pause
|
||||
if (PlcDelay > 0)
|
||||
Thread.Sleep(PlcDelay);
|
||||
}
|
||||
else if (!Connected)
|
||||
{
|
||||
// wait 5 sec and retry connection
|
||||
Thread.Sleep(5000);
|
||||
Connect();
|
||||
}
|
||||
else
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
if (Connected) Disconnect();
|
||||
Finished = true;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Thread main execution
|
||||
/// </summary>
|
||||
@@ -309,7 +298,8 @@ namespace SCMCncLib
|
||||
|
||||
if (Connected) Disconnect();
|
||||
Finished = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the buffer.
|
||||
@@ -318,6 +308,17 @@ namespace SCMCncLib
|
||||
{
|
||||
// lettura buffer dal CN
|
||||
iError = read_regbuffer(ref StatusAddress, 0, ReadNumber, PLC_MemoryRead);
|
||||
|
||||
// devo definire posizione memorie Vcome TS_REG
|
||||
iError = read_regbuffer(ref VAreaAddress, 68, 32, PLC_MemoryAreaV);
|
||||
#if false
|
||||
// se tutto ok leggo anche buffer V
|
||||
if (iError == 0)
|
||||
{
|
||||
iError = read_regbuffer(ref StatusAddress, 0, ReadNumber, PLC_MemoryAreaV);
|
||||
}
|
||||
#endif
|
||||
|
||||
//System.Buffer.BlockCopy(PLC_MemoryRead, 0, mwEngine.MemoryManager.ReadMemory, 0, mwEngine.MemoryManager.NrByteToRead);
|
||||
// set flag to inform graphic engine that data have been read from device
|
||||
//mwEngine.BufferRead = true;
|
||||
@@ -328,8 +329,10 @@ namespace SCMCncLib
|
||||
/// </summary>
|
||||
private void WriteBuffer()
|
||||
{
|
||||
#if false
|
||||
System.Buffer.BlockCopy(mwEngine.MemoryManager.WriteMemory, 0, PLC_MemoryWrite, 0, mwEngine.MemoryManager.NrByteToWrite);
|
||||
iError = write_regbuffer(ref CommandsAddress, 0, WriteNumber, PLC_MemoryWrite);
|
||||
iError = write_regbuffer(ref CommandsAddress, 0, WriteNumber, PLC_MemoryWrite);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -346,6 +349,9 @@ namespace SCMCncLib
|
||||
iError = get_reg_by_name(StatusAddressName, ref StatusAddress);
|
||||
if (iError == 0)
|
||||
iError = get_reg_by_name(CommandsAddressName, ref CommandsAddress);
|
||||
|
||||
if (iError == 0)
|
||||
iError = get_reg_by_name(VAreaAddressName, ref VAreaAddress);
|
||||
|
||||
Connected = (iError == 0);
|
||||
WriteConnectionStatus();
|
||||
|
||||
Reference in New Issue
Block a user