private void xAxisEventObj_EventNotify(CML_AMP_EVENT match, bool hasError)
        {
            try
            {
                if (hasError)
                {
                    xAxisAmp.HaltMove();
                    DisplayErrorPopup("CMO Error", "Auto Move Error.");
                }

                if (match == CML_AMP_EVENT.AMPEVENT_MOVE_DONE)
                {
                    initLabel.BackColor = Color.Violet;
                }


                int Accel, Vel;
                Accel = Convert.ToInt32(accTextBox.Text);
                Vel   = Convert.ToInt32(velTextBox.Text);

                distMotor = distMotor * (-1);

                moveMotor(Vel, Accel, distMotor);
            }
            catch (Exception ex)
            {
                DisplayErrorPopup("Auto Move Error", "Auto Move Error.");
            }
        }
Esempio n. 2
0
 private void xAxisEventObj_EventNotify(CML_AMP_EVENT match, bool hasError)
 {
     try
     {
         if (direction == false)
         {
             direction = true;
             totalReps = totalReps + 1;
             AutoMoveMotor(true);
         }
         else
         {
             direction = false;
             AutoMoveMotor(false);
         }
     }
     catch (Exception ex)
     {
         xAxisAmp.HaltMove();
         xAxisEventObj.Stop();
         xAxisAmp.ClearFaults();
         automove = false;
         motorButton.BackgroundImage = TeamMusclesAndMachine.Properties.Resources.Start_button;
         DisplayErrorPopup("Auto Move Error", "Auto Move Error: 200");
     }
 }
        private void haltMoveButton_Click(object sender, EventArgs e)
        {
            try
            {
                doMoveButton.Enabled   = false;
                HomeAxisButton.Enabled = false;

                //set halt mode desired before halting the move
                xAxisAmp.HaltMode = CML_HALT_MODE.HALT_DECEL;
                // now halt the move
                xAxisAmp.HaltMove();

                doMoveButton.Enabled   = true;
                HomeAxisButton.Enabled = true;
            }
            catch (Exception ex)
            {
                doMoveButton.Enabled   = true;
                HomeAxisButton.Enabled = true;
                DisplayError(ex);
            }
        }