Difference between revisions of "Program Examples:Setting Up an Axis"

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "The following example demonstrate how to setup an axis. It will configure basic setup of a rotary axis, with 32000 encoder counts per degree with velocity in deg/sec and accle...")
 
Line 5: Line 5:
 
common shared pos_unit as long = 32000
 
common shared pos_unit as long = 32000
 
Program
 
Program
 
 
     Call SetRotAxis(A1,-1000,1000)
 
     Call SetRotAxis(A1,-1000,1000)
 
End Program
 
End Program
 +
 
sub SetRotAxis(ax as generic axis, byval minval as double , byval maxval as double)
 
sub SetRotAxis(ax as generic axis, byval minval as double , byval maxval as double)
 
   with ax
 
   with ax

Revision as of 13:29, 28 July 2014

The following example demonstrate how to setup an axis. It will configure basic setup of a rotary axis, with 32000 encoder counts per degree with velocity in deg/sec and accleration in deg/sec2. Position of this axis will be limited in the range of -1000 to +1000 degrees.

common shared pos_unit as long = 32000
Program
    Call SetRotAxis(A1,-1000,1000)
End Program

sub SetRotAxis(ax as generic axis, byval minval as double , byval maxval as double)
  with ax
    attach
      En = 0
      AxisType = 1
      PositionFactor = pos_unit/360
      VelocityFactor = PositionFactor /1000
      AccelerationFactor = VelocityFactor /1000
      Jerkfactor = AccelerationFactor /1000
      VelocityMax = 1000
      AccelerationMax = 10000
      DecelerationMax= 10000
      JerkMax = 20*amax
      VelocityCruise = 0.5*VelocityMax
      Acceleration = AccelerationMax 
      Deceleration = DecelerationMax
      Jerk = JerkMax 
      PrfType = -1
      Smooth = -1
      VelocityOverspeed = 1.2*VelocityMax
      VelocitySafetyLimit = 10*VelocityMax
      PositionErrorDelay = 2
      PositionErrorMax  = 1
      PositionMax = maxval
      PositionMin = minval
      PositionMaxEn = 1
      PositionMinEn = 1
      PositionRolloverEnable = 0
   detach
  end with
end sub