Assembly and Commissioning Instructions Servo amplifier D1-N 15.10.2015
Programming examples (no liability accepted)
Example 1: Simple absolute 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;
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
// Label name for jumping to end of program
till(I5); // Wait until input I5 is activated
X_trg = 720896; // Absolute positioning in increments
till(~X_run); // Wait until motor has reached the position
till(I5); // Wait until input I5 is activated
X_trg = 1441792; // Absolute positioning in increments
till(~X_run); // Wait until motor has reached the position
goto _Loop; // Program jump
ret;
Example 2: Using a procedure for positioning with the variable factors speed,
acceleration, deceleration, jerk limitation and input-coded position orders.
proc move_p_v_a_d(long p, long v, long a, long d) do // Procedure definition P=Position, V= Velocity, a= acceleration, d= deceleration
#long m_p; // Variable Position
#long m_v; // Variable Velocity
#long m_a; // Variable Acceleration
#long m_d; // Variable Deceleration
m_p = X_trg; // Assign PDL variable of drive controller variable
X_trg=p;
m_v = X_vel_max;
X_vel_max = v;
m_a = X_acc;
X_acc = a;
m_d = X_dcc;
X_dcc = d;
end;
#task/1; // This task runs immediately after controller initialisation
_Test1:
call _Reference travel; // Call up the program called "_Reference travel"
ret;
_Reference travel: // Jump mark for jumping to program
till(X_en=1); // Wait until motor is subject to control
till(I1);
sleep 2000; // Wait until enable is received for reference travel
call _X_init_exec; // Start reference travel as set in Lightening
till(~X_run); // Wait until reference travel is complete and/or motor is no longer moving