private void moveMotor(int speed, int acceleration, int distance) { double vel, accel, dist; // test speed vel = Convert.ToDouble(speed + 10) * 10; accel = Convert.ToDouble(acceleration) * 100; dist = Convert.ToDouble(distance) * 10; ProfileSettings = xAxisAmp.ProfileSettings; // read profile settings from amp //Set the profile type for move ProfileSettings.ProfileType = CML_PROFILE_TYPE.PROFILE_TRAP; //Set the profile trajectory values ProfileSettings.ProfileAccel = accel; ProfileSettings.ProfileDecel = accel; ProfileSettings.ProfileVel = vel; // Update the amplier's profile settigns xAxisAmp.ProfileSettings = ProfileSettings; xAxisAmp.Enable(); // Enable Motor xAxisAmp.MoveAbs(dist); // Execute the move }
//Code for button with mouse pressed private void JogPosButton_MouseDown(System.Object eventSender, System.Windows.Forms.MouseEventArgs eventArgs)// Handles JogPosButton.MouseDown { try { //Sets velocity, acceleration, deceleration limits for move to inputed values ProfileSettings.ProfileType = CML_PROFILE_TYPE.PROFILE_VELOCITY; ProfileSettings.ProfileAccel = Convert.ToDouble(AccelTextBox.Text); ProfileSettings.ProfileDecel = Convert.ToDouble(DecelTextBox.Text); ProfileSettings.ProfileVel = Convert.ToDouble(VelocityTextBox.Text); //Store inputed parameters as the profile settings xAxisAmp.ProfileSettings = ProfileSettings; //Performs positive move. 1 indicates positive move, -1 indicates negative move xAxisAmp.MoveAbs(1); } catch (Exception ex) { DisplayError(ex); } }