Function that moves the given axes (1-:-32) toward the target position value set with a velocity profile toward trapezoidal time.
Note: The difference with the mva_to_n_v() function is that it cannot be called with axis(s) already in motion and the final velocity on the target cannot be specified.
|
i32 mva_to_n (i32 start, stru_mvitp stru [, i32 nDef=1] [, i32 holdFlag=0] [, real fr=1])
|
|
Flag to enable data re-acknowledgement (only if axes stopped).
The flag is reset when the data is taken
|
|
Structure of type stru_mvitp containing motion-related parameters
|
|
Array size (number of axes involved). (optional, default 1)
|
|
Flag to command HOLD status to the mission. (optional, default 0)
|
|
Speed reduction value (0-1). (optional, default 1)
See fr
|
|
Variable containing information about the status of the function (see returns codes).
|
|
-5 [M_ILLEGAL_ARGS]
|
Illegal parameter (acc=0 or illegal axis number)
|
-6 [M_IN_ALARM]
|
Alarm (axis ip already set)
|
2 [M_POSITIONING]
|
Initial positioning
|
6 [M_REACHED]
|
Target reached.
This means that either the direction is 0 and the axis is stationary, or the direction is +1 or -1 and the axis has reached one of the end of strokes
|
14 [M_HOLDED]
|
Motion stopped due to HOLD flag.
It is also returned in cases where the desired axis speed is imposed to 0 or the feedrate is set to zero
|
15 [M_ACCEL]
|
Acceleration in progress
|
16 [M_AT_SPEED]
|
Motion at speed
|
17 [M_DECEL]
|
Deceleration in progress
|
|
|
Rule
|
|
The mission may involve multiple axes (max 32). They will be linearly interpolated in order to reach their targets all together
|
•Generate alarm 9900 ill. Arg. A:2 T:x ST:xxx if invalid axis number
•Generates alarm 9900 ill. Arg. A:3 T:x ST:xxx if acc = 0
•Generate alarm 9903 Par. are changed T:x ST:xxx if running axis sequence changed
•Generate alarm 2800 Double Position Set T:x ST:xxx if already imposed axis ip |
Example of use:
stru_mvitp m1[3]
int restartFlag
int holdflg
motion
if(first_time())
rr(1000) = 100
rr(1001) = 10
rr(1002) = 20
rr(1003) = 20
rr(2000) = 100
rr(2001) = 10
rr(2002) = 20
rr(2003) = 20
rr(3000) = 100
rr(3001) = 10
rr(3002) = 20
rr(3003) = 20
restartFlag = true
endif
m1[0].nAx = 1
m1[0].target = rr(1000)
m1[0].v = rr(1001)
m1[0].acc = rr(1002)
m1[0].dec = rr(1003)
m1[0].decH = max_acc(1)
m1[1].nAx = 2
m1[1].target = rr(2000)
m1[1].v = rr(2001)
m1[1].acc = rr(2002)
m1[1].dec = rr(2003)
m1[1].decH = max_acc(2)
m1[2].nAx = 3
m1[2].target = rr(3000)
m1[2].v = rr(3001)
m1[2].acc = rr(3002)
m1[2].dec = rr(3003)
m1[2].decH = max_acc(3)
esito = mva_to_n(restartFlag, m1[0], 3, hold, fr)
if(rise(esito = M_REACHED))
if(avanti)
inc(rr(1000),100)
inc(rr(2000),100)
inc(rr(3000),100)
avanti = false
restartFlag = true
else
dec(rr(1000),100)
dec(rr(2000),100)
dec(rr(3000),100)
avanti = true
restartFlag = true
endif
endif
end_motion
|
|