axis_qty = 1 'the number of project axis
'Stop Ethernet port section
WA(5000) ' 5 sec delay-warm up
ETHERCAT(0,0) 'ethercat running command

RUN "CLEAR_UNIT_ALARM" 'calling sub routine
RUN "AXISALARM", 9 'calling sub routine
RUN "COMMAND", 8 'calling sub routine

DIM i AS INTEGER
FOR i = 0 TO axis_qty-1
    BASE(i)
    UNITS = 2 ^ 20 'according to your Servo-Motor encoder resolution
    SPEED = 10 '600RPM
    ACCEL = 100
    DECEL = ACCEL
    '(optional properties)
    'JOGSPEED = 5 '300RPM
    'CREEP = 0.1
    'REP_DIST = 360
    'REP_OPTION = 0
    DRIVE_FE_LIMIT = 100 '100turn - per revolution
    FE_LIMIT = 100 'the maximum following error
    FE_RANGE = 70 ' following error report range - shows in status
    FS_LIMIT = 400000000000
    RS_LIMIT = -400000000000
    AXIS_ENABLE = ON ' enable the axis in controller
    SERVO = ON 'run the axis in controller
NEXT i


WAIT UNTIL PROC_STATUS PROC(8) = 1 'waiting for the COMMAND page running
PRINT "Axis Added & COMMAND page is running!"
