#include <SysDef.mh>
#include "..\..\..\..\..\SDK\SDK_ApossC.mc"
#define AXIS1_NO 0 // Axis module number
#define STEPPER_OL_STEPS 200 // Resolution of the stepper → 200 Steps per rev → 1.8 deg/ step
#define STEPPER_OL_CONTCUR 4000 // Nomial continious current allowed in mA
#define STEPPER_OL_MAXCUR STEPPER_OL_CONTCUR * 1.25 // Maximal current allowed in mA
#define STEPPER_OL_THERMAL_TIME 25600 // Thermal time constant of the winding
#define STEPPER_OL_MAX_RPM 400 // Maximum velocity in RPM
#define STEPPER_OL_CURKPROP 20000 // Proportional factor of current controller
#define STEPPER_OL_CURKINT 250 // Integral factor of current controller
#define STEPPER_OL_CURKILIM 32767 // Integral limit of current controller
#define STEPPER_OL_VELRES 100 // Velocity resolution, Scaling used for the velocity and acceleration/deceleration commands
#define STEPPER_OL_RAMPTYPE RAMPTYPE_JERKLIMITED // Defines the ramptype
#define STEPPER_OL_RAMPMIN 100 // Maximum acceleration
#define STEPPER_OL_JERKMIN 100 // Minimum time (ms) required before reaching the maximum acceleration
#define STEPPER_OL_POSERR 0 // Maximal track/ position error allowed in qc
#define STEPPER_OL_DIRECTION 1 // User units have normal orientation.
#define STEPPER_OL_POSENCREV 1 // Number of revolutions of the motor
#define STEPPER_OL_POSFACT_Z 1 // Number of revolutions of the input shaft
#define STEPPER_OL_POSFACT_N 1 // Number of revolutions of the output shaft in POSFACT_Z revolutions of the input shaft
#define STEPPER_OL_FEEDREV 1 // Number of revolutions of the gear box output shaft
#define STEPPER_OL_FEEDDIST 36000 // Distance travelled (in user units) in FEEDREV revolutions of the gear box output shaft
#define STEPPER_OL_KPROP 0 // Proportional value for PID position control loop
#define STEPPER_OL_KINT 0 // Integral value for PID position control loop
#define STEPPER_OL_KDER 0 // Derivative value for PID position control loop
#define STEPPER_OL_KILIM 0 // Limit value for the integral sum of the PID position control loop
#define STEPPER_OL_KILIMTIME 0 // Time used to increase or decrease the integral limit
#define STEPPER_OL_BANDWIDTH 0 // Bandwidth within which the PID filter is active. 1000 equals to 100% velocity setpoint
#define STEPPER_OL_FFVEL 0 // Velocity Feed forward
#define STEPPER_OL_KFFAC 0 // Acceleration Feed forward
#define STEPPER_OL_KFFDEC 0 // Deceleration Feed Forward
long setupStepper_OL(long axisNo);
long main(void)
{
ErrorClear();
DefOrigin(AXIS1_NO);
setupStepper_OL(AXIS1_NO);
AxisControl(AXIS1_NO, ON);
while(1)
{
Delay(500);
}
return(0);
}
long setupStepper_OL(long axisNo)
{
STEPPER_OL_STEPS,
STEPPER_OL_MAXCUR,
STEPPER_OL_MAX_RPM
);
STEPPER_OL_CURKPROP,
STEPPER_OL_CURKINT,
STEPPER_OL_CURKILIM
);
STEPPER_OL_VELRES,
STEPPER_OL_MAX_RPM,
STEPPER_OL_RAMPTYPE,
STEPPER_OL_RAMPMIN,
STEPPER_OL_JERKMIN,
STEPPER_OL_POSERR
);
STEPPER_OL_POSENCREV,
STEPPER_OL_POSFACT_Z,
STEPPER_OL_POSFACT_N,
STEPPER_OL_FEEDREV,
STEPPER_OL_FEEDDIST
);
STEPPER_OL_KPROP,
STEPPER_OL_KINT,
STEPPER_OL_KDER,
STEPPER_OL_KILIM,
STEPPER_OL_KILIMTIME,
STEPPER_OL_BANDWIDTH,
STEPPER_OL_FFVEL,
STEPPER_OL_KFFAC,
STEPPER_OL_KFFDEC
);
return(1);
}