From c4278504bf312e95bebc0fed74e7dfd552f45722 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 31 Oct 2017 17:05:00 +0100 Subject: [PATCH] Aggiunte note e test x contapezzi --- IOB-WIN/App.config | 1 + IOB-WIN/IobFanuc.cs | 72 ++++++++++++++++++++++++++++++++++++++++--- IOB-WIN/IobGeneric.cs | 11 +++++++ 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/IOB-WIN/App.config b/IOB-WIN/App.config index d0dee0dd..fc33d370 100644 --- a/IOB-WIN/App.config +++ b/IOB-WIN/App.config @@ -10,6 +10,7 @@ + diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs index ba025ee9..018f1511 100644 --- a/IOB-WIN/IobFanuc.cs +++ b/IOB-WIN/IobFanuc.cs @@ -173,7 +173,7 @@ namespace IOB_WIN parentForm.sIN = Semaforo.SV; // leggo SEMAFORI, leggo da Y8 ...leggo 6 bit da Y8 a Y13... byte[] MemBlock = new byte[RawInput.Length]; - // Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DOorsClosed: Y10.5 + // Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DoorsClosed: Y10.5 int memIndex = 8; inizio = DateTime.Now; if (verboseLog) lg.Info("START FanucMemRW-Y"); @@ -208,6 +208,19 @@ namespace IOB_WIN if (nReadIN % 50 == 0) lg.Info(string.Format("Dati F: {0:X} | {1:X}", MemBlockF[0], MemBlockF[1])); MemBlockF_pre = MemBlockF; //if (nReadIN % 50 == 0) lg.Info(string.Format("Dati G: {0:X}", MemBlockG)); + + // commento lettura X... +#if false + byte[] MemBlockX = new byte[2]; + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlockX); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); + // output! + for (int i = 0; i < MemBlockX.Length; i++) + { + lg.Info(string.Format("MemBlockX[{0}]: {0} | {1}", i, utils.binaryForm((int)MemBlockX[i]))); + } +#endif } } /// @@ -245,13 +258,13 @@ namespace IOB_WIN { B_input += 1 << 1; } - // NON HO CONTAPEZZI ovvero 1 << 3 - // B1: verde! Y8.4 + // NON HO CONTAPEZZI ovvero 1 << 2 + // B3: Rosso! Y8.4 if ((primoByte & 16) > 0) { B_input += 1 << 3; } - // B1: verde! Y8.5 + // B4: giallo! Y8.5 if ((primoByte & 32) > 0) { B_input += 1 << 4; @@ -318,6 +331,7 @@ namespace IOB_WIN /// public override void processContapezzi() { + //base.processContapezzi(); if (utils.CRB("enableContapezzi")) { @@ -338,6 +352,27 @@ namespace IOB_WIN // output! + // posizioni DWord + //1602:543809: NUM PEZZI x ciclo (6408..6411) + //1603:5300: NUM PEZZI RICHIESTI (6412..6415) + //1604:5007: NUM PEZZI FATTI (6416..6419) + //1605:543809: NUM PEZZI TOTALI (6420..6423) + + + + // aggiunta lettura area X + byte[] MemBlockX = new byte[2]; + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlockX); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); + // output! + for (int i = 0; i < MemBlockX.Length; i++) + { + lg.Info(string.Format("MemBlockX_{0}: {0} | {1}", i, utils.binaryForm((int)MemBlockX[i]))); + } + + // la variabile X7.0 (da 1 a 0) oppure la X7.1 (da 0 a 1) indica il CONTAPEZZI + } catch (Exception exc) { @@ -376,6 +411,35 @@ namespace IOB_WIN dump_MemAreaD(); dump_MemAreaY(); } + public override void sampleMemDump() + { + dump_MemAreaD(6400, 400); + } + /// + /// Dump PERIODICO area D della memoria + /// + /// area memoria di partenza + /// + private void dump_MemAreaD(int memIndex, int memSyzeByte) + { + // leggo TUTTI i 9999 byte della memoria D... + byte[] MemBlockD = new byte[memSyzeByte]; + inizio = DateTime.Now; + if (verboseLog) lg.Info("START MemDump AreaD"); + FanucMemRW(R, FANUC.MemType.D, memIndex, ref MemBlockD); + if (verboseLog) lg.Info("END MemDump AreaD"); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-MemDumpD", MemBlockD.Length), DateTime.Now.Subtract(inizio).Ticks); + // file out! + string nomeFile = ""; + Dictionary mappaValori = new Dictionary(); + // salvo in file i dati letti come DWord (4byte) + nomeFile = string.Format(@"{0}\SAMPLES\MemDump_D_DW_{1:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, DateTime.Now); + for (int i = 0; i < MemBlockD.Length / 4; i++) + { + mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt32(MemBlockD, i * 4).ToString()); + } + utils.WritePlain(mappaValori, nomeFile); + } /// /// Dump area D della memoria /// diff --git a/IOB-WIN/IobGeneric.cs b/IOB-WIN/IobGeneric.cs index ba7593c8..a51b0189 100644 --- a/IOB-WIN/IobGeneric.cs +++ b/IOB-WIN/IobGeneric.cs @@ -414,6 +414,8 @@ namespace IOB_WIN { // recupero dati SETUP (sysinfo) e li invio/mostro se variati... processSysInfo(); + // se richiesto faccio salvataggio aree memorie + if (utils.CRB("doSampleMemory")) sampleMemDump(); // eventuale log! if (utils.CRB("recTime")) logTimeResults(); } @@ -1516,6 +1518,15 @@ namespace IOB_WIN public virtual void saveMemDump() { } + /// + /// metodo dummy x salvataggio aree memoria conf x CN + /// + public virtual void sampleMemDump() + { + } + + + #endregion