Exemplo n.º 1
0
        // run to selected component
        private void bt_selcomp_Click(object sender, RoutedEventArgs e)
        {
            DataHelpers dh = new DataHelpers();

            Nozzle1Xoffset = dh.Nozzle1Xoffset;
            Nozzle1Yoffset = dh.Nozzle1Yoffset;
            Nozzle2Xoffset = dh.Nozzle2Xoffset;
            Nozzle2Yoffset = dh.Nozzle2Yoffset;


            Int32  ComponentCode = Int32.Parse(dd_ComponentSelect.SelectedValue.ToString());
            string ComponentName = comp.GetComponentValue(dd_ComponentSelect.SelectedValue.ToString());

            kfl.PlacementNozzle = ComponentCode;
            kfl.PickSpeed       = 50;
            kfl.PlaceSpeed      = comp.GetPlaceSpeed(ComponentCode.ToString(), 50);

            kfl.FeederX      = CalcXLocation(comp.GetFeederX(ComponentCode.ToString()), kfl.PlacementNozzle);
            kfl.FeederY      = CalcYLocation(comp.GetFeederY(ComponentCode.ToString()), kfl.PlacementNozzle);
            kfl.FeederHeight = comp.GetFeederHeight(ComponentCode.ToString());

            kfl.PlaceHeight = comp.GetPlacementHeight(ComponentCode.ToString());

            kfl.TapeFeeder = comp.GetComponentTapeFeeder(ComponentCode.ToString());

            kfl.PlaceX        = 0;
            kfl.PlaceY        = 0;
            kfl.PlaceRotation = 0;

            kfl.VerifyCamera = false;


            SetFeederOutputs(comp.GetFeederID(ComponentCode.ToString())); // send feeder to position

            _kflop.MoveSingleFeed(kfl.PickSpeed, kfl.FeederX, kfl.FeederY, ClearHeight, ClearHeight, 0, 0);


            if (comp.GetComponentTapeFeeder(ComponentCode.ToString()))
            {
                while (!usbController.GetFeederReadyStatus())
                {
                    Thread.Sleep(10);
                }
                Thread.Sleep(50);
                if (kfl.PlacementNozzle == 1)
                {
                    // use picker 1
                    _kflop.MoveSingleFeed(kfl.PickSpeed, kfl.FeederX, kfl.FeederY, kfl.FeederHeight, ClearHeight, 0, 0);
                    // Thread.Sleep(200);
                    // go down and turn on suction
                    // usbController.SetVAC1(true);
                    // Thread.Sleep(150);
                    // _kflop.MoveSingleFeed(kfl.PickSpeed, kfl.FeederX, kfl.FeederY, ClearHeight, ClearHeight, 0, 0);
                }
                else
                {
                    // nozzle 2 on tape feeder
                    _kflop.MoveSingleFeed(kfl.PickSpeed, kfl.FeederX, kfl.FeederY, ClearHeight, kfl.FeederHeight, 0, 0);
                    Thread.Sleep(200);
                    // go down and turn on suction
                    //usbController.SetVAC2(true);
                    //Thread.Sleep(150);
                    //_kflop.MoveSingleFeed(kfl.PickSpeed, kfl.FeederX, kfl.FeederY, ClearHeight, ClearHeight, 0, 0);
                }
            }
            else
            {
                // use picker 2
                while (usbController.CheckChipMotorRunning())
                {
                    Thread.Sleep(10);
                }
                _kflop.MoveSingleFeed(kfl.PickSpeed, kfl.FeederX, kfl.FeederY, ClearHeight, kfl.FeederHeight, 0, 0);
                // Thread.Sleep(200);

                // usbController.SetVAC2(true);
                // Thread.Sleep(300);
                // kf.MoveSingleFeed(kfl.PickSpeed, kfl.FeederX, kfl.FeederY, ClearHeight, ClearHeight, 0, 0);
            }
        }