diff --git a/IOB-WIN/IobFanuc.cs b/IOB-WIN/IobFanuc.cs index d36475a0..2b888181 100644 --- a/IOB-WIN/IobFanuc.cs +++ b/IOB-WIN/IobFanuc.cs @@ -205,55 +205,58 @@ namespace IOB_WIN try { - if (verboseLog) lg.Info("inizio read semafori"); - parentForm.sIN = Semaforo.SV; - // leggo SEMAFORI, leggo da Y8 ...leggo 3 bit in Y8..Y10 HARD CODED, rendere parametrico!!! - byte[] MemBlock = new byte[4]; + if (verboseLog) lg.Info("inizio read semafori"); + parentForm.sIN = Semaforo.SV; + // leggo SEMAFORI, leggo da Y8 ...leggo 3 bit in Y8..Y10 HARD CODED, rendere parametrico!!! + byte[] MemBlock = new byte[4]; - // da rivedere: cambio come leggo i dati hard coded in base al modello, RENDERE CMQ PARAMETRICO!!! - if (currIobConf.vendor == "TORNOS" && currIobConf.model == "DT26") - { - // Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DoorsClosed: Y10.5 - int memIndex = 8; - inizio = DateTime.Now; - FanucMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlock); - if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-Y", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks); - // riporto! - Buffer.BlockCopy(MemBlock, 0, RawInput, 0, 4); - // ora mi leggo 2 byte in area X... HARD CODED, rendere parametrico... - MemBlock = new byte[2]; - // GESTIONE memoria endcycle - // la variabile X7.0 (da 1 a 0) oppure la X7.1 (da 0 a 1) indica il CONTAPEZZI --> copio 2 byte! - inizio = DateTime.Now; - FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlock); - if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); - } - else if (currIobConf.vendor == "CMZ" && currIobConf.model == "TA20")// caso CMZ - { - // Red: Y3.7 | Yellow: Y3.6 | Green Y3.5 | All DoorsClosed: Y5.1 | ..........WrkZone Y8.7 - int memIndex = 3; - inizio = DateTime.Now; - FanucMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlock); - if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-Y", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks); - // riporto! - Buffer.BlockCopy(MemBlock, 0, RawInput, 0, 4); + // da rivedere: cambio come leggo i dati hard coded in base al modello, RENDERE CMQ PARAMETRICO!!! + if (currIobConf.vendor == "TORNOS" && currIobConf.model == "DT26") + { + // Red: Y8.4 | Yellow: Y8.5 | Green Y8.6 | WrkZone Y8.7 | All DoorsClosed: Y10.5 + int memIndex = 8; + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlock); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-Y", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks); + // riporto! + Buffer.BlockCopy(MemBlock, 0, RawInput, 0, 4); + // ora mi leggo 2 byte in area X... HARD CODED, rendere parametrico... + MemBlock = new byte[2]; + // GESTIONE memoria endcycle + // la variabile X7.0 (da 1 a 0) oppure la X7.1 (da 0 a 1) indica il CONTAPEZZI --> copio 2 byte! + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlock); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); + // riporto! + Buffer.BlockCopy(MemBlock, 0, RawInput, 4, 2); + // log + if (verboseLog) lg.Info(string.Format("RawInput: {0}", utils.binaryForm((int)RawInput[0]))); + } + else if (currIobConf.vendor == "CMZ" && currIobConf.model == "TA20")// caso CMZ + { + // Red: Y3.7 | Yellow: Y3.6 | Green Y3.5 | All DoorsClosed: Y4.0 (X5.1) | ..........WrkZone Y8.7 + int memIndex = 3; + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlock); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-Y", MemBlock.Length), DateTime.Now.Subtract(inizio).Ticks); + // riporto! + Buffer.BlockCopy(MemBlock, 0, RawInput, 0, 4); #if false - // ora mi leggo 2 byte in area X... HARD CODED, rendere parametrico... - MemBlock = new byte[2]; - // GESTIONE memoria endcycle - // la variabile X7.0 (da 1 a 0) oppure la X7.1 (da 0 a 1) indica il CONTAPEZZI --> copio 2 byte! - inizio = DateTime.Now; - FanucMemRW(R, FANUC.MemType.X, 6, ref MemBlock); - if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); -#endif - } + // ora mi leggo 2 byte in area X... HARD CODED, rendere parametrico... + MemBlock = new byte[2]; + // GESTIONE memoria PORTA CHIUSA (X5.1 = porta chiusa, X5.0 = porta aperta) --> copio 2 byte! + inizio = DateTime.Now; + FanucMemRW(R, FANUC.MemType.X, 5, ref MemBlock); + if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-X", MemBlockF.Length), DateTime.Now.Subtract(inizio).Ticks); - // riporto! - Buffer.BlockCopy(MemBlock, 0, RawInput, 4, 2); - // log - if (verboseLog) lg.Info(string.Format("RawInput: {0}", utils.binaryForm((int)RawInput[0]))); - // salvo il solo BYTE dell'input decifrando il semaforo... - decodeToBitmap(); + // riporto! + Buffer.BlockCopy(MemBlock, 0, RawInput, 4, 2); +#endif + // log + if (verboseLog) lg.Info(string.Format("RawInput: {0}", utils.binaryForm((int)RawInput[0]))); + } + // salvo il solo BYTE dell'input decifrando il semaforo... + decodeToBitmap(); } catch (Exception exc) { @@ -312,7 +315,7 @@ namespace IOB_WIN { B_input += 1 << 1; } - + // FARE da lettura parametro 6711... //// B2: contapezzi da area X //if ((byteCount & 2) > 0)