// Constructors & Finalizers -------------------------------------------
 public ReadWriteRFIDController(HSTWorkcell workcell, string controllerID, string controllerName, ReaderType readerType, RFHead head)
     : base(workcell, controllerID, controllerName)
 {
     _workcell          = workcell;
     this._controllerID = controllerID;
     // Rfid reader
     try
     {
         if (readerType == ReaderType.Fola)
         {
             _RFIDScanner = HSTMachine.Workcell.RFIDScanner;
         }
     }
     catch (Exception ex)
     {
         ExceptionRFID _exceptionRFID = new ExceptionRFID();
     }
 }
Ejemplo n.º 2
0
        private void btnTestHgaFola_Click(object sender, EventArgs e)
        {
            //FolaTagDataForm form = new FolaTagDataForm();
            //form.ShowDialog();

            FolaReader  folaTag  = new FolaReader();
            FolaTagData folaData = new FolaTagData();

            try
            {
                // Don't forget to place file GCL52FW.DLL and RFID.DLL in the same directory with this executable file
                // Both files are in "lib" directory

                // FOLA = Read/Write Carrier Tag

                folaTag.PortSettings.PortName = "COM9"; // Don't need to set another values (baud rate, parity, databit, stopbit) , leave them default.
                folaTag.Initialize(false);

                // --- Read ----
                folaTag.ReadRFIDTag(0, ref folaData);  // Read from Head 0
                //folaData.CarrierID <- Carrier ID
                // folaData.WorkOrder <- WorkOrder
                // folaData.WorkOrderVersion <- WorkOrder Version
                // folaData[0].HgaSN <-- 1st HGA Serial Number
                // folaData[0].Status <-- 1st HGA Status
                // .....
                // .....
                // folaData[9].HgaSN <-- last HGA Serial Number
                // folaData[9].Status <-- last HGA Status

                //folaData[0].HgaSN = "DDDDDDDDDD";
                //folaData[0].Status = 'A';
                //folaData.SetProcessStepData(5, 'V', new StringBuilder("ZZZZZZ"));
                //folaData.LastStep = 6;
                //folaData.ProcStep[5].StationCode = folaData.ProcStep[4].StationCode;
                //folaData.ProcStep[5].ProcessRecipe = folaData.ProcStep[4].ProcessRecipe;
                //folaData.LastStep = 8;

                //folaTag.WriteRFIDTag(0, folaData);

                //folaData = folaTag.ReadRFIDTag(0);

                // --- Write ----

                //folaData[0].HgaSN = "XYZ100001D"; // 10 digig HGA serial number , for loading S/N will be generated by the machine
                //// the s/n is generated from carrier id(3)+slot(1)+cycle count(5)+check sum(1) = totally 10 digit
                //// use below functions to generate serial number
                //folaData[0].Status = 'A'; // HGA Status A = Pass , B = Fail
                //// .....
                //folaData[9].HgaSN = "XYZA00001Z";
                //folaData[9].Status = 'A';


                //// For CLU , write count must be plus one everytime
                //folaData.WriteCount++;

                //// Get Process Step from WorkOrder [Process]
                //folaData.ProcStep[0].StationCode = 'A'; // <-- ProcessStep1=A
                //folaData.ProcStep[0].ProcessRecipe = "SLS-1"; // <-- ProgramName1=SLS-1
                //folaData.ProcStep[1].StationCode = 'C'; // <-- ProcessStep2=C
                //folaData.ProcStep[1].ProcessRecipe = "SAS-1"; // <-- ProgramName2=SAS-1
                //folaData.ProcStep[2].StationCode = 'Q'; // <-- ProcessStep3=Q
                //folaData.ProcStep[2].ProcessRecipe = "SUL-1"; // <-- ProgramName3=SUL-1
                //folaData.ProcStep[3].StationCode = ' ';
                //folaData.ProcStep[3].ProcessRecipe = "";
                //// .....
                //folaData.ProcStep[folaData.MaxProcStep - 1].StationCode = ' ';
                //folaData.ProcStep[folaData.MaxProcStep - 1].ProcessRecipe = "";

                //folaData.LastStep = 1; // CLU Load Module is station code A , process step = 1 <- set laststep = process step

                // WriteRFIDTag(RFHead rfHead, FolaTagData tag, bool reReadBeforeWrite, bool writeProcessStep)
                // reReadBeforeWrite , true = compare the carrierID inside the RF tag and carrierID inside FolaTagData before writing to prevent wrong carrier writing.
                // writeProcessStep , true = write Process Step/Setup File too, For CLU must set as true.
                // WriteRFIDTag will not write CarrierID
                //folaTag.WriteRFIDTag(0, folaData, true);

                //byte checksum = folaTag.ReadCheckSum(0);
                //folaTag.WriteCheckSum(0, 0xac);

                MessageBox.Show("Done");
            }
            catch (ExceptionRFID ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            folaTag.ShutDown();
        }