public void OutSideLoadToInSideUnload() { // [假設 Tray 移到 In, 並已放入 盒子] // 1. Tray 移到 Home, // 2. 檢查有沒有 Box, // 3. (1) 沒有盒子=> 退回In 並 警示 // (2) 有盒子=> 移到 Out MacHalDrawerKjMachine testDrawer = null; MacHalCabinet cabinet = null; MacHalContext halContext = null; try { halContext = new MacHalContext("GenCfg/Manifest/Manifest.xml.real"); halContext.MvaCfLoad(); cabinet = halContext.HalDevices[EnumMacDeviceId.cabinet_assembly.ToString()] as MacHalCabinet; testDrawer = cabinet.Hals[EnumMacDeviceId.cabinet_drawer_01_01.ToString()] as MacHalDrawerKjMachine; testDrawer.HalConnect(); testDrawer.OnTrayMotionFailedHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.WriteLine($"Index={drawer.DeviceIndex}, 觸發 {nameof(drawer.OnTrayMotionFailedHandler)} 事件"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 觸發 drawer.OnTrayMotionFailedHandler 事件"); }; testDrawer.OnTrayMotionOKHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.WriteLine($"Index={drawer.DeviceIndex}, 觸發 {nameof(drawer.OnTrayMotionOKHandler)} 事件"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 觸發 drawer.OnTrayMotionOKHandler 事件"); }; testDrawer.OnTrayMotionSensorOFFHandler += (sender, e) => { // vs 2013 IMacHalDrawer drawer = (IMacHalDrawer)sender; //Debug.WriteLine($"Index={drawer.DeviceIndex}, 觸發 {nameof(drawer.OnTrayMotionSensorOFFHandler)} 事件"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 觸發 drawer.OnTrayMotionSensorOFFHandler 事件"); }; testDrawer.OnERRORErrorHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.WriteLine($"Index={drawer.DeviceIndex}, 觸發 {nameof(drawer.OnERRORErrorHandler)} 事件"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 觸發 drawer.OnERRORErrorHandler 事件"); }; testDrawer.OnERRORREcoveryHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.WriteLine($"Index={drawer.DeviceIndex}, 觸發 {nameof(drawer.OnERRORREcoveryHandler)} 事件"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 觸發 drawer.OnERRORREcoveryHandler 事件"); }; testDrawer.OnTrayMotioningHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.WriteLine($"Index={drawer.DeviceIndex}, 觸發 {nameof(drawer.OnTrayMotioningHandler)} 事件"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 觸發 drawer.OnTrayMotioningHandler 事件"); }; /**到逹 Home*/ testDrawer.OnTrayArriveHomeHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.WriteLine($"Index={drawer.DeviceIndex}, 檢查有沒有放盒子"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 檢查有沒有放盒子"); drawer.CommandBoxDetection(); }; /**檢查沒有盒子 */ testDrawer.OnDetectedEmptyBoxHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; /** // vs 2013 * Debug.WriteLine($"Index={drawer.DeviceIndex}, 沒有盒子"); * Debug.WriteLine($"Index={drawer.DeviceIndex}, 將 Drawer 送回 In"); */ Debug.WriteLine("Index=" + drawer.DeviceId + ", 沒有盒子"); Debug.WriteLine("Index=" + drawer.DeviceId + ", 將 Drawer 送回 In"); drawer.CommandTrayMotionIn(); }; /**檢查有盒子 */ testDrawer.OnDetectedHasBoxHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.Write($"Indexx={drawer.DeviceIndex}, 有放盒子, 將 Drawer 送往 Out"); Debug.Write("Index=" + drawer.DeviceId + ", 有放盒子, 將 Drawer 送往 Out"); drawer.CommandTrayMotionOut(); }; testDrawer.OnTrayArriveOutHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.WriteLine($"Index={drawer.DeviceIndex}, 已經到達 Out "); Debug.WriteLine("Index=" + drawer.DeviceId + ", 已經到達 Out "); }; testDrawer.OnTrayArriveInHandler += (sender, e) => { IMacHalDrawer drawer = (IMacHalDrawer)sender; // vs 2013 //Debug.Write($"Index={drawer.DeviceIndex}, Drawer沒有盒子, 已經退回 In , 請重新裝入盒子"); Debug.Write("Index=" + drawer.DeviceId + ", Drawer沒有盒子, 已經退回 In , 請重新裝入盒子"); }; testDrawer.CommandTrayMotionHome(); Repeat(); } catch (Exception ex) { var deviceIndex = testDrawer == null ? "" : testDrawer.DeviceId; // vs 2013 // Debug.WriteLine($"Index={deviceIndex}, Exception={ex.Message}"); Debug.WriteLine("Index=" + deviceIndex + ", Exception=" + ex.Message); } finally { if (halContext != null) { halContext.Dispose(); } } }
public void TestPathMove() { int boxStartIndex = default(int); int boxEndIndex = default(int); try { using (var halContext = new MacHalContext("GenCfg/Manifest/Manifest.xml.real")) { halContext.MvCfLoad(); var bt = halContext.HalDevices[MacEnumDevice.boxtransfer_assembly.ToString()] as MacHalBoxTransfer; if (bt.HalConnect() != 0) { System.Diagnostics.Debug.WriteLine("Connect Fail"); } bt.GotoStage1(); // [V] 回到 Cabinet 1 Home bt.BackCabinet1Home(); // [ ] 前進到 Cabinet 1 的某個盒子 boxStartIndex = 1; boxEndIndex = 1;// boxEndIndex :最多 20 for (var boxIndex = boxStartIndex; boxIndex <= boxEndIndex; boxIndex++) { bt.ForwardToCabinet1(boxIndex); System.Threading.Thread.Sleep(2000); } // [ ] 從 Cabinet 1 回到 Cabinet1 Home bt.BackwardFromCabinet1(); // [ ] 轉到 Cabinet 2 方向 bt.ChangeDirectionToFaceCabinet2(); // [ ] 前到 Cabinet 2 某個盒子 boxStartIndex = 1; boxEndIndex = 1;// boxEndIndex :最多 15 for (var boxIndex = boxStartIndex; boxIndex <= boxEndIndex; boxIndex++) { bt.ForwardToCabinet2(boxIndex); System.Threading.Thread.Sleep(2000); } // [ ] 從 Cabnet 2 回到 Cabinet2 Home bt.BackwardFromCabinet2(); // [ ] 轉向面對Open Stage 方向 bt.ChangeDirectionToFaceOpenStage(); // [ ] 前進到 Open Stage bt.ForwardToOpenStage(); // [ ] 從 Open Stage 回到 Open Stage bt.BackwardFromOpenStage(); // [ ] 轉向 Cbinet 方向 bt.ChangeDirectionToFaceCabinet1(); } } catch (Exception ex) { throw ex; } }
public void TestMethod1()//OK { try { using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { halContext.MvaCfBootup(); halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var bt = halContext.HalDevices[EnumMacDeviceId.boxtransfer_assembly.ToString()] as MacHalBoxTransfer; var ic = halContext.HalDevices[EnumMacDeviceId.inspectionch_assembly.ToString()] as MacHalInspectionCh; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); bt.HalConnect(); ic.HalConnect(); os.HalConnect(); uint BoxType = 1;//1:鐵盒 , 2:水晶盒 os.Initial(); #region Iron Box //1. 光罩鐵盒(無光罩)放置於Open Stage上方 //2. Load Cell可以讀出光罩鐵盒(無光罩)重量, 確認鐵盒有放置好位置 var BoxWeight = os.ReadWeightOnStage(); if (BoxType == 1) { if ((BoxWeight < 560 || BoxWeight > 590) && (BoxWeight < 895 || BoxWeight > 925)) { throw new Exception("Wrong iron box weight, box weight = " + BoxWeight.ToString()); } } else if (BoxType == 2) { if ((BoxWeight < 290 || BoxWeight > 320) && (BoxWeight < 625 || BoxWeight > 655)) { throw new Exception("Wrong crystal box weight, box weight = " + BoxWeight.ToString()); } } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. Open Stage固定光罩鐵盒 by 整定棒 os.SetBoxType(BoxType); os.SortClamp(); //6. Open Stage固定光罩鐵盒 by 吸盤 os.Vacuum(true); os.SortUnclamp(); os.Lock(); //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. 透過Box Robot PIN, 開啟光罩鐵盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //9. 開盒機構正常開啟光罩鐵盒 os.Close(); os.Clamp(); os.Open(); //10. Fiber Sensor確認光罩鐵盒已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Unclamp(); os.Lock(); os.Vacuum(false); #endregion Iron Box //11. 重複1~10步驟, 再執行光罩鐵盒(有光罩) / 光罩水晶盒(無光罩) / 光罩水晶盒(有光罩)之情境 #region Iron Box with Mask //1. 光罩鐵盒(有光罩)放置於Open Stage上方 //2. Load Cell可以讀出光罩鐵盒(有光罩)重量, 確認鐵盒有放置好位置 if (BoxType == 1) { if ((BoxWeight < 560 || BoxWeight > 590) && (BoxWeight < 895 || BoxWeight > 925)) { throw new Exception("Wrong iron box weight, box weight = " + BoxWeight.ToString()); } } else if (BoxType == 2) { if ((BoxWeight < 290 || BoxWeight > 320) && (BoxWeight < 625 || BoxWeight > 655)) { throw new Exception("Wrong crystal box weight, box weight = " + BoxWeight.ToString()); } } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. Open Stage固定光罩鐵盒 by 整定棒 os.SetBoxType(BoxType); os.SortClamp(); //6. Open Stage固定光罩鐵盒 by 吸盤 os.Vacuum(true); os.SortUnclamp(); os.Lock(); //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. 透過Box Robot PIN, 開啟光罩鐵盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //9. 開盒機構正常開啟光罩鐵盒 os.Close(); os.Clamp(); os.Open(); //10. Fiber Sensor確認光罩鐵盒已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Unclamp(); os.Lock(); os.Vacuum(false); #endregion Iron Box with Mask BoxType = 2; //11. 重複1~10步驟, 再執行光罩水晶盒(無光罩) / 光罩水晶盒(有光罩)之情境 #region Crystal Box //1. 光罩水晶盒(無光罩)放置於Open Stage上方 //2. Load Cell可以讀出光罩水晶盒(無光罩)重量, 確認水晶盒有放置好位置 BoxWeight = os.ReadWeightOnStage(); if (BoxType == 1) { if ((BoxWeight < 560 || BoxWeight > 590) && (BoxWeight < 895 || BoxWeight > 925)) { throw new Exception("Wrong iron box weight, box weight = " + BoxWeight.ToString()); } } else if (BoxType == 2) { if ((BoxWeight < 290 || BoxWeight > 320) && (BoxWeight < 625 || BoxWeight > 655)) { throw new Exception("Wrong crystal box weight, box weight = " + BoxWeight.ToString()); } } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. Open Stage固定光罩水晶盒 by 整定棒 os.SetBoxType(BoxType); os.SortClamp(); //6. Open Stage固定光罩水晶盒 by 吸盤 os.Vacuum(true); os.SortUnclamp(); os.Lock(); //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. 透過Box Robot PIN, 開啟光罩水晶盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //9. 開盒機構正常開啟光罩水晶盒 os.Close(); os.Clamp(); os.Open(); //10. Fiber Sensor確認光罩水晶盒已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Unclamp(); os.Lock(); os.Vacuum(false); #endregion Crystal Box //11. 重複1~10步驟, 再執光罩水晶盒(有光罩)之情境 #region Crystal Box with Mask //1. 光罩水晶盒(有光罩)放置於Open Stage上方 //2. Load Cell可以讀出光罩水晶盒(有光罩)重量, 確認水晶盒有放置好位置 if (BoxType == 1) { if ((BoxWeight < 560 || BoxWeight > 590) && (BoxWeight < 895 || BoxWeight > 925)) { throw new Exception("Wrong iron box weight, box weight = " + BoxWeight.ToString()); } } else if (BoxType == 2) { if ((BoxWeight < 290 || BoxWeight > 320) && (BoxWeight < 625 || BoxWeight > 655)) { throw new Exception("Wrong crystal box weight, box weight = " + BoxWeight.ToString()); } } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. Open Stage固定光罩水晶盒 by 整定棒 os.SetBoxType(BoxType); os.SortClamp(); //6. Open Stage固定光罩水晶盒 by 吸盤 os.Vacuum(true); os.SortUnclamp(); os.Lock(); //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. 透過Box Robot PIN, 開啟光罩水晶盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.UnlockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //9. 開盒機構正常開啟光罩水晶盒 os.Close(); os.Clamp(); os.Open(); //10. Fiber Sensor確認光罩水晶盒已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Unclamp(); os.Lock(); os.Vacuum(false); #endregion Crystal Box with Mask } } catch (Exception ex) { throw ex; } }
public void TestMethod3()//OK { try { using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { halContext.MvaCfBootup(); halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var lpa = halContext.HalDevices[EnumMacDeviceId.loadportA_assembly.ToString()] as MacHalLoadPort; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); lpa.HalConnect(); os.HalConnect(); uint BoxType = 1;//1:鐵盒 , 2:水晶盒 os.Initial(); //1. 光罩放置於Open Stage上的鐵盒內 os.SetBoxType(BoxType); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); var BoxWeight = os.ReadWeightOnStage(); if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Clamp(); os.Open(); if (os.ReadCoverSensor().Item1 == false) { throw new Exception("Box status was not opened"); } //2. Mask Robot從Home點移動至Open Stage上方 os.SetRobotIntrude(false, true); mt.RobotMoving(true); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); os.SetRobotIntrude(false, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } mt.RobotMoving(false); //3. Mask Robot在Open Stage進行光罩夾取 mt.Clamp(1); //4. Mask Robot將光罩從Open Stage移動至Load Port B處 (不放置) mt.RobotMoving(true); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); os.SetRobotIntrude(false, false); mt.ExePathMove(pathFileObj.FromLPHomeToLP2PathFile()); mt.RobotMoving(false); //5. Mask Robot將光罩從Load Port B, 移回Open Stage mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromLP2ToLPHomePathFile()); os.SetRobotIntrude(false, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } mt.RobotMoving(false); //6. Mask Robot將光罩放置於Open Stage上 mt.Unclamp(); //7. Mask Robot (無夾持光罩) 從Open Stage移回Home點 mt.RobotMoving(true); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); mt.RobotMoving(false); os.SetRobotIntrude(false, false); os.Close(); os.Unclamp(); os.Vacuum(false); os.Lock(); BoxType = 2; //8. 重複1~7, 執行Open Stage上水晶盒的傳送測試 //1. 光罩放置於Open Stage上的水晶盒內 os.SetBoxType(BoxType); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); BoxWeight = os.ReadWeightOnStage(); if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Clamp(); os.Open(); if (os.ReadCoverSensor().Item1 == false) { throw new Exception("Box status was not opened"); } //2. Mask Robot從Home點移動至Open Stage上方 os.SetRobotIntrude(false, true); mt.RobotMoving(true); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); os.SetRobotIntrude(false, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } mt.RobotMoving(false); //3. Mask Robot在Open Stage進行光罩夾取 mt.Clamp(1); //4. Mask Robot將光罩從Open Stage移動至Load Port B處 (不放置) mt.RobotMoving(true); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); os.SetRobotIntrude(false, false); mt.ExePathMove(pathFileObj.FromLPHomeToLP2PathFile()); mt.RobotMoving(false); //5. Mask Robot將光罩從Load Port B, 移回Open Stage mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromLP2ToLPHomePathFile()); os.SetRobotIntrude(false, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } mt.RobotMoving(false); //6. Mask Robot將光罩放置於Open Stage上 mt.Unclamp(); //7. Mask Robot (無夾持光罩) 從Open Stage移回Home點 mt.RobotMoving(true); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); mt.RobotMoving(false); os.SetRobotIntrude(false, false); os.Close(); os.Unclamp(); os.Vacuum(false); os.Lock(); } } catch (Exception ex) { throw ex; } }
public void TestMethod2()//OK { try { using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { halContext.MvaCfBootup(); halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var ic = halContext.HalDevices[EnumMacDeviceId.inspectionch_assembly.ToString()] as MacHalInspectionCh; var lpb = halContext.HalDevices[EnumMacDeviceId.loadportB_assembly.ToString()] as MacHalLoadPort; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); lpb.HalConnect(); ic.HalConnect(); ic.Initial(); //1. 光罩放置於Inspection Chamber Stage上 //2. Mask Robot從Home點移動至Inspection Chamber ic.SetRobotIntrude(true); mt.RobotMoving(true); mt.ChangeDirection(pathFileObj.InspChHomePathFile()); mt.ExePathMove(pathFileObj.FromICHomeToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICStagePathFile()); mt.RobotMoving(false); //3. Mask Robot在Inspection Chamber 內進行光罩夾取 mt.Clamp(1); //4. Mask Robot將光罩從Inspection Chamber移動至Load Port B處 (不放置) mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromICStageToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICHomePathFile()); ic.SetRobotIntrude(false); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); mt.ExePathMove(pathFileObj.FromLPHomeToLP2PathFile()); mt.RobotMoving(false); //5. Mask Robot將光罩從Load Port B, 移回Inspection Chamber mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromLP2ToLPHomePathFile()); mt.ChangeDirection(pathFileObj.InspChHomePathFile()); ic.SetRobotIntrude(true); mt.ExePathMove(pathFileObj.FromICHomeToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICStagePathFile()); mt.RobotMoving(false); //6. Mask Robot將光罩放置於Inspection Chamber Stage上 mt.Unclamp(); //7. Mask Robot (無夾持光罩) 從Inspection Chamber移回Home點 mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromICStageToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICHomePathFile()); ic.SetRobotIntrude(false); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); mt.RobotMoving(false); } } catch (Exception ex) { throw ex; } }
public void DrawerCommandTest() { try { using (var halContext = new MacHalContext("GenCfg/Manifest/Manifest.xml.real")) { halContext.MvCfLoad(); var cabinet = halContext.HalDevices[MacEnumDevice.cabinet_assembly.ToString()] as MacHalCabinet; var drawer_01_01 = cabinet.Hals[MacEnumDevice.cabinet_drawer_01_01.ToString()] as MacHalDrawerKjMachine; var drawer_01_02 = cabinet.Hals[MacEnumDevice.cabinet_drawer_01_02.ToString()] as MacHalDrawerKjMachine; var isConnected = drawer_01_01.HalConnect(); // vs 2013 // Debug.WriteLine($"IsConnected={isConnected}"); Debug.WriteLine("IsConnected=" + isConnected); drawer_01_02.HalConnect(); BindEvents(drawer_01_01); BindEvents(drawer_01_02); /** CommandSetMotionSpeed */ drawer_01_01.CommandSetMotionSpeed(100); drawer_01_02.CommandSetMotionSpeed(100); /** CommandPositionRead * drawer_01_02.CommandPositionRead(); * drawer_01_01.CommandPositionRead(); */ /** CommandBoxDetection * drawer_01_01.CommandBoxDetection(); * drawer_01_02.CommandBoxDetection(); */ /**CommandBrightLEDAllOn() * drawer_01_01.CommandBrightLEDAllOn(); * drawer_01_02.CommandBrightLEDAllOn(); */ /**CommandBrightLEDAllOff() * drawer_01_01.CommandBrightLEDAllOff(); * drawer_01_02.CommandBrightLEDAllOff(); */ /** CommandBrightLEDGreenOn() * drawer_01_01.CommandBrightLEDGreenOn(); * drawer_01_02.CommandBrightLEDGreenOn(); */ /** CommandBrightLEDRedOn() * drawer_01_01.CommandBrightLEDRedOn(); * drawer_01_02.CommandBrightLEDRedOn(); */ /** CommandINI() * drawer_01_01.CommandINI(); * drawer_01_02.CommandINI(); */ /** CommandSetTimeOut() * drawer_01_01.CommandSetTimeOut(100); * drawer_01_02.CommandSetTimeOut(100); */ /** CommandTrayMotionHome() * drawer_01_01.CommandTrayMotionHome(); * drawer_01_02.CommandTrayMotionHome(); */ /** CommandTrayMotionHome() * drawer_01_01.CommandTrayMotionIn(); * drawer_01_02.CommandTrayMotionIn(); */ /** CommandTrayMotionHome() * drawer_01_01.CommandTrayMotionOut(); * drawer_01_01.CommandTrayMotionOut(); */ Repeat(); } } catch (Exception ex) { } }
public void TestRobotOCAP() { try { using (var halContext = new MacHalContext("GenCfg/Manifest/Manifest.xml.real")) { halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var bt = halContext.HalDevices[EnumMacDeviceId.boxtransfer_assembly.ToString()] as MacHalBoxTransfer; var ic = halContext.HalDevices[EnumMacDeviceId.inspectionch_assembly.ToString()] as MacHalInspectionCh; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); ic.HalConnect(); os.HalConnect(); bool BTIntrude = false; bool MTIntrude = false; ThreadStart GetAndOpenBoxThread = () => { try { //TODO:Cabinet控制推出Box bt.RobotMoving(true); bt.ExePathMove(@"D:\Positions\BTRobot\Cabinet_01_Home.json"); bt.Unclamp(); bt.ExePathMove(@"D:\Positions\BTRobot\Cabinet_01_Home_Forward_Drawer_01_01_GET.json"); bt.Clamp(1); bt.ExePathMove(@"D:\Positions\BTRobot\Drawer_01_01_Backward_Cabinet_01_Home_GET.json"); bt.RobotMoving(false); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(true, false).Item1; if (BTIntrude == true) { break; } else if (i == 1 && BTIntrude == false) { throw new Exception("Open Stage not allowed to be BT intrude!!"); } else { os.Initial(); } } bt.RobotMoving(true); bt.ExePathMove(@"D:\Positions\BTRobot\Cabinet1_Home_Forward_OpenStage_PUT.json"); bt.Unclamp(); bt.ExePathMove(@"D:\Positions\BTRobot\OpenStage_Backward_Cabinet1_Home_PUT.json"); bt.RobotMoving(false); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(false, false).Item1; if (i == 1 && BTIntrude == true || os.ReadRobotIntruded().Item1 == true || os.ReadRobotIntruded().Item2 == true) { throw new Exception("Open Stage has been BT intrude,can net execute command!!"); } } os.SetBoxType(1); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(true, false).Item1; if (BTIntrude == true) { break; } else if (i == 1 && BTIntrude == false) { throw new Exception("Open Stage not allowed to be BT intrude!!"); } else { os.Initial(); } } bt.RobotMoving(true); bt.ExePathMove(@"D:\Positions\BTRobot\UnlockBox.json"); bt.RobotMoving(false); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(false, false).Item1; if (i == 1 && BTIntrude == true || os.ReadRobotIntruded().Item1 == true || os.ReadRobotIntruded().Item2 == true) { throw new Exception("Open Stage has been BT intrude,can net execute command!!"); } } os.Close(); os.Clamp(); os.Open(); } catch (Exception ex) { throw ex; } }; ThreadStart CloseAndStoreBoxThread = () => { try { //TODO:Cabinet控制推出抽屜 os.Close(); os.Unclamp(); os.Lock(); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(true, false).Item1; if (BTIntrude == true) { break; } else if (i == 1 && BTIntrude == false) { throw new Exception("Open Stage not allowed to be BT intrude!!"); } else { os.Initial(); } } bt.RobotMoving(true); bt.ExePathMove(@"D:\Positions\BTRobot\Cabinet_01_Home.json"); bt.ExePathMove(@"D:\Positions\BTRobot\LockBox.json"); bt.RobotMoving(false); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(false, false).Item1; if (i == 1 && BTIntrude == true || os.ReadRobotIntruded().Item1 == true || os.ReadRobotIntruded().Item2 == true) { throw new Exception("Open Stage has been BT intrude,can net execute command!!"); } } os.Vacuum(false); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(true, false).Item1; if (BTIntrude == true) { break; } else if (i == 1 && BTIntrude == false) { throw new Exception("Open Stage not allowed to be BT intrude!!"); } else { os.Initial(); } } bt.RobotMoving(true); bt.Unclamp(); bt.ExePathMove(@"D:\Positions\BTRobot\Cabinet1_Home_Forward_OpenStage_GET.json"); bt.Clamp(1); bt.ExePathMove(@"D:\Positions\BTRobot\OpenStage_Backward_Cabinet1_Home_GET.json"); bt.RobotMoving(false); for (int i = 0; i < 2; i++) { BTIntrude = os.SetRobotIntrude(false, false).Item1; if (i == 1 && BTIntrude == true || os.ReadRobotIntruded().Item1 == true || os.ReadRobotIntruded().Item2 == true) { throw new Exception("Open Stage has been BT intrude,can net execute command!!"); } } bt.RobotMoving(true); bt.ExePathMove(@"D:\Positions\BTRobot\Cabinet_01_Home_Forward_Drawer_01_01_PUT.json"); bt.Unclamp(); bt.ExePathMove(@"D:\Positions\BTRobot\Drawer_01_01_Backward_Cabinet_01_Home_PUT.json"); bt.RobotMoving(false); } catch (Exception ex) { throw ex; } }; ThreadStart LPGetMaskToInspThread = () => { try { mt.RobotMoving(true); mt.ChangeDirection(@"D:\Positions\MTRobot\LoadPortHome.json"); mt.Unclamp(); mt.ExePathMove(@"D:\Positions\MTRobot\LPHomeToLP1.json"); mt.Clamp(0); mt.ExePathMove(@"D:\Positions\MTRobot\LP1ToLPHome.json"); mt.RobotMoving(false); //ic.XYPosition(100,200); //ic.WPosition(51); mt.RobotMoving(true); mt.ChangeDirection(@"D:\Positions\MTRobot\InspChHome.json"); mt.ExePathMove(@"D:\Positions\MTRobot\ICHomeFrontSideToIC.json"); mt.Unclamp(); mt.ExePathMove(@"D:\Positions\MTRobot\ICFrontSideToICHome.json"); mt.RobotMoving(false); mt.RobotMoving(true); mt.ExePathMove(@"D:\Positions\MTRobot\ICHomeFrontSideToIC.json"); mt.Clamp(0); mt.ExePathMove(@"D:\Positions\MTRobot\ICFrontSideToICHome.json"); mt.RobotMoving(false); mt.RobotMoving(true); mt.ExePathMove(@"D:\Positions\MTRobot\ICHomeBackSideToIC.json"); mt.Unclamp(); mt.ExePathMove(@"D:\Positions\MTRobot\ICBackSideToICHome.json"); mt.RobotMoving(false); mt.RobotMoving(true); mt.ExePathMove(@"D:\Positions\MTRobot\ICHomeBackSideToIC.json"); mt.Clamp(0); mt.ExePathMove(@"D:\Positions\MTRobot\ICBackSideToICHome.json"); mt.RobotMoving(false); } catch (Exception ex) { throw ex; } }; ThreadStart MaskCleanThread = () => { try { mt.RobotMoving(true); mt.ExePathMove(@"D:\Positions\MTRobot\CCHomeFrontSideToCC.json"); mt.ExePathMove(@"D:\Positions\MTRobot\CCFrontSideToClean.json"); mt.ExePathMove(@"D:\Positions\MTRobot\FrontSideCleanFinishToCC.json"); mt.ExePathMove(@"D:\Positions\MTRobot\CCFrontSideToCapture.json"); mt.ExePathMove(@"D:\Positions\MTRobot\FrontSideCaptureFinishToCC.json"); mt.ExePathMove(@"D:\Positions\MTRobot\CCFrontSideToCCHome.json"); mt.ExePathMove(@"D:\Positions\MTRobot\CCHomeBackSideToCC.json"); mt.ExePathMove(@"D:\Positions\MTRobot\CCBackSideToClean.json"); mt.ExePathMove(@"D:\Positions\MTRobot\BackSideCleanFinishToCC.json"); mt.ExePathMove(@"D:\Positions\MTRobot\CCBackSideToCapture.json"); mt.ExePathMove(@"D:\Positions\MTRobot\BackSideCaptureFinishToCC.json"); mt.ExePathMove(@"D:\Positions\MTRobot\CCBackSideToCCHome.json"); mt.RobotMoving(false); } catch (Exception ex) { throw ex; } }; ThreadStart MaskToLPThread = () => { try { mt.RobotMoving(true); mt.ChangeDirection(@"D:\Positions\MTRobot\LoadPortHome.json"); mt.ExePathMove(@"D:\Positions\MTRobot\LPHomeToLP1.json"); mt.Unclamp(); mt.ExePathMove(@"D:\Positions\MTRobot\LP1ToLPHome.json"); mt.RobotMoving(false); } catch (Exception ex) { throw ex; } }; Thread BoxGet = new Thread(GetAndOpenBoxThread); Thread BoxStore = new Thread(CloseAndStoreBoxThread); Thread MaskInsp = new Thread(LPGetMaskToInspThread); Thread MaskClean = new Thread(MaskCleanThread); Thread MaskOut = new Thread(MaskToLPThread); MaskInsp.Start(); MaskInsp.Join(); MaskClean.Start(); MaskClean.Join(); MaskOut.Start(); } } catch (Exception ex) { throw ex; } }
public void TestMethod1()//OK { try { using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { halContext.MvaCfBootup(); halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var bt = halContext.HalDevices[EnumMacDeviceId.boxtransfer_assembly.ToString()] as MacHalBoxTransfer; var ic = halContext.HalDevices[EnumMacDeviceId.inspectionch_assembly.ToString()] as MacHalInspectionCh; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); bt.HalConnect(); ic.HalConnect(); os.HalConnect(); uint BoxType = 1;//1:鐵盒 , 2:水晶盒 os.Initial(); #region Iron Box //1.光罩鐵盒(無光罩)放置於Open Stage上方且上蓋已是開啟狀態 os.SetBoxType(BoxType); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Clamp(); os.Open(); //2. Fiber Sensor確認光罩鐵盒上蓋已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item1 == false) { throw new Exception("Box status was not opened"); } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. 開關盒機構可正常闔上光罩鐵盒上蓋 os.Close(); os.Unclamp(); os.Lock(); //6. 透過Box Robot PIN, 關閉光罩鐵盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. Open Stage吸盤鬆開光罩鐵盒 os.Vacuum(false); //9. Open Stage整定棒鬆開光罩鐵盒 os.SortUnclamp(); //10. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //11. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); #endregion Iron Box //12. 重複1~11步驟, 再執行光罩鐵盒(有光罩) / 光罩水晶盒(無光罩) / 光罩水晶盒(有光罩)之情境 #region Iron Box with Mask //1.光罩鐵盒(有光罩)放置於Open Stage上方且上蓋已是開啟狀態 os.SetBoxType(BoxType); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Clamp(); os.Open(); //2. Fiber Sensor確認光罩鐵盒上蓋已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item1 == false) { throw new Exception("Box status was not opened"); } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. 開關盒機構可正常闔上光罩鐵盒上蓋 os.Close(); os.Unclamp(); os.Lock(); //6. 透過Box Robot PIN, 關閉光罩鐵盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. Open Stage吸盤鬆開光罩鐵盒 os.Vacuum(false); //9. Open Stage整定棒鬆開光罩鐵盒 os.SortUnclamp(); //10. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //11. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); #endregion Iron Box with Mask BoxType = 2; //12. 重複1~11步驟, 再執行光罩水晶盒(無光罩) / 光罩水晶盒(有光罩)之情境 #region Crystal Box //1.光罩水晶盒(無光罩)放置於Open Stage上方且上蓋已是開啟狀態 os.SetBoxType(BoxType); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Clamp(); os.Open(); //2. Fiber Sensor確認光罩水晶盒上蓋已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item1 == false) { throw new Exception("Box status was not opened"); } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. 開關盒機構可正常闔上光罩水晶盒上蓋 os.Close(); os.Unclamp(); os.Lock(); //6. 透過Box Robot PIN, 關閉光罩水晶盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. Open Stage吸盤鬆開光罩水晶盒 os.Vacuum(false); //9. Open Stage整定棒鬆開光罩水晶盒 os.SortUnclamp(); //10. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //11. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); #endregion Crystal Box //12. 重複1~11步驟, 再執行光罩水晶盒(有光罩)之情境 #region Crystal Box with Mask //1.光罩水晶盒(有光罩)放置於Open Stage上方且上蓋已是開啟狀態 os.SetBoxType(BoxType); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Clamp(); os.Open(); //2. Fiber Sensor確認光罩水晶盒上蓋已開啟 & 辨識光罩盒種類 if (os.ReadCoverSensor().Item1 == false) { throw new Exception("Box status was not opened"); } //3. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //4. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //5. 開關盒機構可正常闔上光罩水晶盒上蓋 os.Close(); os.Unclamp(); os.Lock(); //6. 透過Box Robot PIN, 關閉光罩水晶盒鈕扣 if (BoxType == 1) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockIronBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } else if (BoxType == 2) { bt.RobotMoving(true); os.SetRobotIntrude(true, null); bt.ExePathMove(pathFileObj.LockCrystalBoxPathFile()); os.SetRobotIntrude(false, null); bt.RobotMoving(false); } //7. Front CCD可以拍照取像(FOV正確) os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); //8. Open Stage吸盤鬆開光罩水晶盒 os.Vacuum(false); //9. Open Stage整定棒鬆開光罩水晶盒 os.SortUnclamp(); //10. (編號10 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Left_CapToSave("D:/Image/OS/Left", "jpg"); os.LightForFrontBarDfsSetValue(0); //11. (編號11 - CCD): 開啟光源->拍照(FOV正確)->關閉光源 os.LightForFrontBarDfsSetValue(6); os.Camera_Right_CapToSave("D:/Image/OS/Right", "jpg"); os.LightForFrontBarDfsSetValue(0); #endregion Crystal Box with Mask } } catch (Exception ex) { throw ex; } }
[DataRow(EnumMacMaskBoxType.IronBox, true, DrawerReplaceBoxPlace.In)] // 鐵盒 //[DataRow(BoxType.CrystalBox,true)] // 水晶盒 public void TestMethod1(EnumMacMaskBoxType boxType, bool autoConnect, DrawerReplaceBoxPlace drawerReplaceBoxPlace) { var BREAK_POINT = 0; using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { /** Index & array * [0] [1] [2] * 1-2, 1-3, 1-4 IP: 31~33 * ------------------ * [3] [4] [5] * 2-2, 2-3, 2-4, IP: 41~43 * ------------------ * [6] [7] [8] * 3-2, 3-3, 3-4, IP: 51~53 * ---------------- * [9] [10] [11] * 4-2, 4-3, 4-4, IP: 61~63 * ------------------ * [12] [13] [14] * 5-2, 5-3, 5-4, IP: 71~73 * ------------------ * [15] [16] [17] * 6-2, 6-3, 6-4, IP: 81~83 *-------------------- * [18] [19] * 7-2, 7-3, IP: 91~92 */ halContext.MvaCfBootup(); halContext.MvaCfLoad(); try { var uni = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var bt = halContext.HalDevices[EnumMacDeviceId.boxtransfer_assembly.ToString()] as MacHalBoxTransfer; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; string btMovePathFile = default(string); uni.HalConnect(); bt.HalConnect(); os.HalConnect(); halContext.DrawersConnect(); //bt.Reset(); bt.Initial(); //bt.TurnToCB1Home(); int start = 8; int end = 10; for (var i = start; i < end; i++) { try { var drawerLocation = DrawerLocations[i]; var drawer = halContext.GetDrawer(DrawerKeys[i]); IMacHalDrawer previousDrawer = null; var drawerHome = drawerLocation.GetCabinetHomeCode().Item2; /** 00 預先動作, 如有上一輪的 Drawer, 將上一輪的 Drawer 推回到 Out , 取出 Box, 將Box放到現在的 Drawer Tray中, 並將 Tray 放回 Home */ // 0.1 如有上一輪的 Drawer, 將其 Tray 移到 可抽換 box 的位置 if (i > start) { previousDrawer = halContext.GetDrawer(DrawerKeys[i - 1]); previousDrawer.MoveTrayToHome(); if (drawerReplaceBoxPlace == DrawerReplaceBoxPlace.In) { previousDrawer.MoveTrayToIn(); } else { previousDrawer.MoveTrayToOut(); } } // 0.2 將目前的 Drawer Tray Initial drawer.Initial(); // 0.3 將 目前的 Drawer Tray 移回 可以置換 Drawer 的地方 if (drawerReplaceBoxPlace == DrawerReplaceBoxPlace.In) { drawer.MoveTrayToIn(); } else { drawer.MoveTrayToOut(); } /**1. 光罩盒置於 Drawer內*/ BREAK_POINT++; //[[[[[[[[[[[[[[[[[[一定要暫停]]]]]]]]]]]]]]]]]]]]]]]]]] 確認有 Box後往下執行 // 1.1 如有上一個 Drawer, 將上一個 Drawer 移到 Home if (previousDrawer != null) { // previousDrawer.MoveTrayToHome();; } // 1.2 Drawer Tray 往機台內部移動到可以取得光罩的位置 drawer.MoveTrayToHome(); drawer.MoveTrayToIn(); /** 02 Box Robot從Home點至Drawer entry處*/ if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home) { // Drawer 01-01 ~ Drawer 03-05 bt.TurnToCB1Home(); btMovePathFile = pathFileObj.FromCabinet01HomeToDrawer_GET_PathFile(drawerLocation); // Box Transfer 要去 Drawer 夾盒子, 所以用 GET } else //if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home) { // // Drawer 04-01 ~ Drawer 07-05 //Cabinet 2 Drawer 的 Path bt.TurnToCB1Home(); bt.TurnToCB2Home(); btMovePathFile = pathFileObj.FromCabinet02HomeToDrawer_GET_PathFile(drawerLocation); // Box Transfer 要去 Drawer 夾盒子, 所以用 GET } bt.Move(btMovePathFile); /** 03 (編號13-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/ try { var lightValue = bt.GetCameraLightValue(boxType); bt.LightForGripperSetValue(lightValue); bt.Camera_CapToSave("D:/Image/BT/Gripper", "jpg"); //bt.LightForGripper(0); } catch (Exception ex) { MvaLog.WarnNs(this, ex); } finally { bt.LightForGripperSetValue(0); } // bt.Clamp((uint)boxType); //var lightValue = bt.GetCameraLightValue(boxType); //var resultTemp=bt.CameraShot("D:/Image/BT/Gripper", "jpg",lightValue); /** 04 Box Robot從Drawer Entry處移至Drawer內進行光罩鐵盒夾取*/ var resultTemp = bt.Clamp((uint)boxType); /** 05 光罩鐵盒夾取前確認Box Robot是水平狀態 (by 水平儀)*/ var Level = bt.ReadLevelSensor(); /** 06 Box Robot將光罩鐵盒從Drawer移動至Open Stage上方*/ // 6.1 回到 Cabinet 1 Home if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home) { btMovePathFile = pathFileObj.FromDrawerToCabinet01Home_GET_PathFile(drawerLocation); // Box Transfer 夾到盒子後,由 Drawer 回到 Home, 用GET bt.Move(btMovePathFile); } else // if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home) { // Drawer 04_01~07~05 回到 Cabinet 1 Home btMovePathFile = pathFileObj.FromDrawerToCabinet02Home_GET_PathFile(drawerLocation);// Box Transfer 夾到盒子後,由 Drawer 回到 Home, 用GET bt.Move(btMovePathFile); bt.TurnToCB1Home(); } // 6.2 boxrobot 移到 OpenStage os.SetRobotIntrude(true, null); btMovePathFile = pathFileObj.FromCabinet01HomeToOpenStage_PUT_PathFile(); // boxrobot 目前有盒子, 要到 Open Stage, 用PUT bt.Move(btMovePathFile); /** 07 光罩鐵盒放置前確認Box Robot是水平狀態 (by 水平儀)*/ Level = bt.ReadLevelSensor(); /** 08 Box Robot將光罩鐵盒放置於Open Stage上*/ bt.Unclamp(); /** 09 Box Robot退出Open Stage, 並回到Box Robot Home點*/ btMovePathFile = pathFileObj.FromOpenStageToCabinet01Home_PUT_PathFile(); bt.Move(btMovePathFile); os.SetRobotIntrude(false, null); /** 10 (編號9-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/ /** * os.LightForTopBarDfsSetValue(200); * os.Camera_Top_CapToSave("D:/Image/OS/Top", "jpg"); * os.LightForTopBarDfsSetValue(0); */ try { os.LightForFrontBarDfsSetValue(85); //bar 0~255 os.LightForSideBarDfsSetValue(140); //bar 0~255 os.LightForTopBarDfsSetValue(20); //bar 0~255 os.Camera_Top_CapToSave("D:/Image/OS/Top", "jpg"); Debug.WriteLine("Open Stage Camera Shot(Top) OK"); } catch (Exception ex) { Debug.WriteLine("Open Stage Camera Shot(Top) Error=" + ex.Message); } finally { os.LightForFrontBarDfsSetValue(0); os.LightForSideBarDfsSetValue(0); os.LightForTopBarDfsSetValue(0); } /** 11 (編號12-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/ /** * os.LightForSideBarDfsSetValue(200); * os.Camera_Side_CapToSave("D:/Image/OS/Side", "jpg"); * os.LightForSideBarDfsSetValue(0); */ try { os.LightForFrontBarDfsSetValue(85); //bar 0~255 os.LightForSideBarDfsSetValue(140); //bar 0~255 os.LightForTopBarDfsSetValue(20); //bar 0~255 os.Camera_Side_CapToSave("D:/Image/OS/Side", "jpg"); Debug.WriteLine("Open Stage Camera Shot OK"); } catch (Exception ex) { Debug.WriteLine("Open Stage Camera Shot(Side) Error=" + ex.Message); } finally { os.LightForFrontBarDfsSetValue(0); os.LightForSideBarDfsSetValue(0); os.LightForTopBarDfsSetValue(0); } /** 12 Box Robot(無夾持光罩鐵盒)從Home點移動進入Open Stage上方*/ os.SetRobotIntrude(true, null); btMovePathFile = pathFileObj.FromCabinet01HomeToOpenStage_GET_PathFile(); bt.Move(btMovePathFile); /** 13 光罩鐵盒夾取前確認Box Robot是水平狀態 (by 水平儀)*/ Level = bt.ReadLevelSensor(); /** 14 Box Robot從Open Stage上方夾取光罩鐵盒*/ bt.Clamp((uint)boxType); /** 15 Box Robot將光罩鐵盒移動至Drawer處*/ // 15.1 Boxrobot 移到 Cabitnet 1 Home btMovePathFile = pathFileObj.FromOpenStageToCabinet01Home_GET_PathFile(); // boxrobot 目前有盒子,要回到 Cabinet 1 Home, 用 GET bt.Move(btMovePathFile); os.SetRobotIntrude(false, null); // 15.2 if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home) { // drawer 01-01 ~ drawer 03-05 btMovePathFile = pathFileObj.FromCabinet01HomeToDrawer_PUT_PathFile(drawerLocation); // boxrobot 目前有盒子,要到 Drawer, 所以用 PUT bt.Move(btMovePathFile); } else //if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home) { // drawer 04-01 ~ drawer 07-05 bt.TurnToCB2Home(); btMovePathFile = pathFileObj.FromCabinet02HomeToDrawer_PUT_PathFile(drawerLocation); // boxrobot 目前有盒子,要到 Drawer, 所以用 PUT bt.Move(btMovePathFile); } /** 16 (編號13-CCD): 開啟光源 -> 拍照(FOV正確) -> 關閉光源*/ try { var lightValue = bt.GetCameraLightValue(boxType); bt.LightForGripperSetValue(lightValue); bt.Camera_CapToSave("D:/Image/BT/Gripper", "jpg"); } catch (Exception ex) { MvaLog.WarnNs(this, ex); } finally { bt.LightForGripperSetValue(0); } //lightValue = bt.GetCameraLightValue(boxType); //resultTemp= bt.CameraShot("D:/Image/BT/Gripper", "jpg", lightValue); /** 17 Box Robot將光罩鐵盒移動至Drawer內*/ bt.Unclamp(); /** 18 Box Robot (無夾持光罩鐵盒) 從Drawer移回Home點*/ // 18.1 Boxrobot 移回 Home 點 if (drawerHome == BoxrobotTransferLocation.Cabinet_01_Home) { btMovePathFile = pathFileObj.FromDrawerToCabinet01Home_PUT_PathFile(drawerLocation); // } else //if(drawerHome == BoxrobotTransferLocation.Cabinet_02_Home) { btMovePathFile = pathFileObj.FromDrawerToCabinet02Home_PUT_PathFile(drawerLocation); // T } bt.Move(btMovePathFile); // 18.2 Drawer 04-01 ~ Drawer 07-05 時 Boxrobot 轉回 Cabitnet 1 Home if (drawerHome == BoxrobotTransferLocation.Cabinet_02_Home) { bt.TurnToCB1Home(); } // drawer.CommandINI(); /** 19 重複1~18步驟, 完成20個Drawer的光罩鐵盒測試*/ /** 20 重複1~19步驟, 完成20個Drawer的光罩水晶盒測試*/ BREAK_POINT++; // [一定要暫停] 這個 drawer 做好了, 準備下一個 } catch (Exception ex) { MvaLog.WarnNs(this, ex); } } } catch (Exception ex) { MvaLog.WarnNs(this, ex); } } }
public void TestMethod2()//OK { try { using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { halContext.MvaCfBootup(); halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var ic = halContext.HalDevices[EnumMacDeviceId.inspectionch_assembly.ToString()] as MacHalInspectionCh; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); os.HalConnect(); ic.HalConnect(); uint BoxType = 1;//1:鐵盒 , 2:水晶盒 ic.Initial(); //1. 光罩放置於Inspection Chamber Stage上 //2. Mask Robot從Home點移動至Inspection Chamber mt.RobotMoving(true); mt.ChangeDirection(pathFileObj.InspChHomePathFile()); ic.SetRobotIntrude(true); mt.ExePathMove(pathFileObj.FromICHomeToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICStagePathFile()); mt.RobotMoving(false); //3. Mask Robot在Inspection Chamber 內進行光罩夾取 mt.Clamp(1); //4. Mask Robot將光罩從Inspection Chamber移動至Open Stage處 (不放置) mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromICStageToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICHomePathFile()); ic.SetRobotIntrude(false); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); os.SetRobotIntrude(false, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } mt.RobotMoving(false); //5. Mask Robot將光罩從Open Stage, 移回Inspection Chamber mt.RobotMoving(true); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); os.SetRobotIntrude(false, false); mt.ChangeDirection(pathFileObj.InspChHomePathFile()); ic.SetRobotIntrude(true); mt.ExePathMove(pathFileObj.FromICHomeToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICStagePathFile()); mt.RobotMoving(false); //6. Mask Robot將光罩放置於Inspection Chamber Stage上 mt.Unclamp(); //7.Mask Robot(無夾持光罩) 從Inspection Chamber移回Home點 mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromICStageToICFrontSidePathFile()); mt.ExePathMove(pathFileObj.FromICFrontSideToICHomePathFile()); ic.SetRobotIntrude(false); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); mt.RobotMoving(false); } } catch (Exception ex) { throw ex; } }
public void TestMethod1()//OK { try { using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { halContext.MvaCfBootup(); halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); os.HalConnect(); uint BoxType = 1;//1:鐵盒 , 2:水晶盒 os.Initial(); os.SetBoxType(BoxType); os.SortClamp(); os.Vacuum(true); os.SortUnclamp(); os.Lock(); if (os.ReadCoverSensor().Item2 == false) { throw new Exception("Box status was not closed"); } os.Close(); os.Clamp(); os.Open(); if (os.ReadCoverSensor().Item1 == false) { throw new Exception("Box status was not opened"); } //1. Mask Robot (無夾持光罩) 從Home點移動至Open Stage mt.RobotMoving(true); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); os.SetRobotIntrude(null, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); os.SetRobotIntrude(null, false); mt.RobotMoving(false); } } catch (Exception ex) { throw ex; } }
public void TestMethod3()//OK { try { using (var halContext = new MacHalContext("UserData/Manifest/Manifest.xml.real")) { halContext.MvaCfBootup(); halContext.MvaCfLoad(); var unv = halContext.HalDevices[EnumMacDeviceId.eqp_assembly.ToString()] as MacHalEqp; var mt = halContext.HalDevices[EnumMacDeviceId.masktransfer_assembly.ToString()] as MacHalMaskTransfer; var lpa = halContext.HalDevices[EnumMacDeviceId.loadportA_assembly.ToString()] as MacHalLoadPort; var lpb = halContext.HalDevices[EnumMacDeviceId.loadportA_assembly.ToString()] as MacHalLoadPort; var os = halContext.HalDevices[EnumMacDeviceId.openstage_assembly.ToString()] as MacHalOpenStage; unv.HalConnect();//需要先將MacHalUniversal建立連線,各Assembly的Hal建立連線時,才能讓PLC的連線成功 mt.HalConnect(); os.HalConnect(); lpa.HalConnect(); lpb.HalConnect(); uint BoxType = 1;//1:鐵盒 , 2:水晶盒 //1.光罩放置於Load Port A的Pod內 //2. Mask Robot從Home點移動至Load Port A上方 mt.RobotMoving(true); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); mt.ExePathMove(pathFileObj.FromLPHomeToLP1PathFile()); mt.RobotMoving(false); //3. Mask Robot在Load Port A進行光罩夾取 mt.Clamp(1); //4. Mask Robot將光罩從Load Port A移動至Open Stage處 (不放置) mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromLP1ToLPHomePathFile()); os.SetRobotIntrude(false, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } mt.RobotMoving(false); //5. Mask Robot將光罩從Open Stage, 移回Load Port A mt.RobotMoving(true); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); os.SetRobotIntrude(false, false); mt.ExePathMove(pathFileObj.FromLPHomeToLP1PathFile()); mt.RobotMoving(false); //6. Mask Robot將光罩放置於Load Port A的Pod內 mt.Unclamp(); //7. Mask Robot (無夾持光罩) 從Load Port A移回Home點 mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromLP1ToLPHomePathFile()); mt.RobotMoving(false); //8. 重複1~7, 執行Load Port B至Open Stage的傳送測試 //1.光罩放置於Load Port B的Pod內 //2. Mask Robot從Home點移動至Load Port B上方 mt.RobotMoving(true); mt.ChangeDirection(pathFileObj.LoadPortHomePathFile()); mt.ExePathMove(pathFileObj.FromLPHomeToLP2PathFile()); mt.RobotMoving(false); //3. Mask Robot在Load Port B進行光罩夾取 mt.Clamp(1); //4. Mask Robot將光罩從Load Port B移動至Open Stage處 (不放置) mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromLP2ToLPHomePathFile()); os.SetRobotIntrude(false, true); mt.ExePathMove(pathFileObj.FromLPHomeToOSPathFile()); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromOSToIronBoxPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromOSToCrystalBoxPathFile()); } mt.RobotMoving(false); //5. Mask Robot將光罩從Open Stage, 移回Load Port B mt.RobotMoving(true); if (BoxType == 1) { mt.ExePathMove(pathFileObj.FromIronBoxToOSPathFile()); } else if (BoxType == 2) { mt.ExePathMove(pathFileObj.FromCrystalBoxToOSPathFile()); } mt.ExePathMove(pathFileObj.FromOSToLPHomePathFile()); os.SetRobotIntrude(false, false); mt.ExePathMove(pathFileObj.FromLPHomeToLP2PathFile()); mt.RobotMoving(false); //6. Mask Robot將光罩放置於Load Port B的Pod內 mt.Unclamp(); //7. Mask Robot (無夾持光罩) 從Load Port B移回Home點 mt.RobotMoving(true); mt.ExePathMove(pathFileObj.FromLP2ToLPHomePathFile()); mt.RobotMoving(false); } } catch (Exception ex) { throw ex; } }