Assembly and Commissioning Instructions Servo amplifier D1-N
15.10.2015
165 / 183
Example 3: Simple relative positioning between 2 positions with zero point
correction
#task/1;
// First task; this task runs immediately after controller initialisation
call _sequence program;
// Program called “_sequence program” is called up
ret;
_sequence program:
till(X_en=1);
// Wait for controller enable and/or until motor is energised
till(X_I_flag=2);
// Wait for index mark of motor once reference travel has been started
// Reference travel is permanently assigned in “Lightening” and is started via a dig. input
X_trg = 107888;
// Zero point correction, motor positioned absolutely
sleep 500;
// Pause 500 ms
X_locate_pos=0;
// Machine zero point
seton O3;
// Message that reference travel is complete; set output O3
sleep 500;
// Pause 500 ms
setoff O3;
// Reset output O3
_Loop:
// Label name for jumping to end of program
till(I5);
// Wait until input I5 is activated
X_trg += 720896;
// Relative position in positive direction in increments
till(~X_run);
// Wait until motor is no longer moving
till(I5);
X_trg -= 1441792;
// Relative position in negative direction in increments
till(~X_run);
goto _Loop;
// Program jump
ret;
Example 4: Use of customer-specific variables, motion profile parameters, IF-
ELSE DO conditions and stop command.
//######### Custom variable = Cycle counter and automatic stop once the Stop conditions are reached #########
#long ciclo;
// Cycle variable
#long numero;
// Number variable
#task/1;
X_vel_max = 1000000;
// Max. speed in incr./s
X_acc = 20000000;
// Max. acceleration in incr./s²
X_dcc = 20000000;
// Max. deceleration in incr./s²
X_new_sm_fac=50;
// Jerk limitation
X_max_err = 32000;
// Max. position error before motor commutation in incr.
ciclo = 0;
// Set cycle variable to zero
numero = 0;
// Set number variable to zero
till(X_en=1 & X_dcbl);
// Wait until motor commutation takes place
till(~X_run);
// Wait until motor is not moving
sleep 1000;
// Wait 1000
ms
X_locate_pos = 0;
// Position = set 0
_Test1:
// Jump mark
sleep 300;
// Wait 300
ms
X_max_err = 700;
// Max. position error in motion in incr.
X_trg = 58000;
// Position absolute 25,000
inc. = 25
mm
till(~X_run & X_en=1 );
// Wait until motor is not moving but is still energised
sleep 300;
// Wait 1000
ms
X_max_err = 700;
// Max. position error in motion in incr.
X_trg = 1000;
// Position absolute 5,000
inc. = 5
mm
till(~X_run & X_en=1 );
// Wait until motor is not moving but is still energised