CognexWaferIDReaderWithCylinder.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using Aitex.Common.Util;
  2. using Aitex.Core.Common;
  3. using Aitex.Core.RT.Device;
  4. using Aitex.Core.RT.Device.Unit;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.RT.Log;
  7. using Aitex.Core.RT.SCCore;
  8. using Aitex.Core.Util;
  9. using MECF.Framework.Common.Communications;
  10. using MECF.Framework.Common.DBCore;
  11. using MECF.Framework.Common.Equipment;
  12. using MECF.Framework.Common.SubstrateTrackings;
  13. using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.LoadPorts;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Drawing;
  17. using System.Drawing.Imaging;
  18. using System.IO;
  19. using System.Linq;
  20. using System.Text;
  21. using System.Text.RegularExpressions;
  22. using System.Threading;
  23. using System.Threading.Tasks;
  24. namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.OcrReaders.Cognex
  25. {
  26. public class CognexWaferIDReaderWithCylinder:CognexWaferIDReader
  27. {
  28. public CognexWaferIDReaderWithCylinder(string module,string name,string scRoot,IoSensor[] dis,IoTrigger[] dos ):base(module,name, scRoot)
  29. {
  30. _diCylinderExtend = dis[1];
  31. _diCylinderRetract = dis[2];
  32. _doCylinderExtend = dos[0];
  33. _doCylinderRetract = dos[1];
  34. }
  35. private IoSensor _diCylinderExtend;
  36. private IoSensor _diCylinderRetract;
  37. private IoTrigger _doCylinderExtend;
  38. private IoTrigger _doCylinderRetract;
  39. protected override bool fStartReadWaferID(object[] param)
  40. {
  41. _doCylinderExtend.SetTrigger(true, out _);
  42. _doCylinderRetract.SetTrigger(false, out _);
  43. int wCount = 0;
  44. while (true)
  45. {
  46. if (_diCylinderExtend.Value && !_diCylinderRetract.Value)
  47. {
  48. break;
  49. }
  50. Thread.Sleep(100);
  51. wCount++;
  52. if (wCount > 100)
  53. {
  54. OnError("MoveCylinderTimeout");
  55. return false;
  56. }
  57. }
  58. return base.fStartReadWaferID(param);
  59. }
  60. protected override bool fMonitorReading(object[] param)
  61. {
  62. if(base.fMonitorReading(param))
  63. {
  64. _doCylinderExtend.SetTrigger(false, out _);
  65. _doCylinderRetract.SetTrigger(true, out _);
  66. return true;
  67. }
  68. return false;
  69. }
  70. }
  71. }