Program Examples:Setting Up an Axis

From SoftMC-Wiki
Revision as of 06:02, 17 July 2017 by Chi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Language: English  • 中文(简体)‎

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