ElmoMC Multi-Axis Motion Controller-Maestro User Manual
Page 274

function vectorHoming(VECTOR vector, int home_pos_x,
int home_pos_y)
global int motionStatus
TRACE("homing vector %", vector.vid)
vector[0].px = home_pos_x
vector[1].px = home_pos_y
vector.mo
=
1
vector[0].pa = home_pos_x
vector[1].pa = home_pos_y
vector.bg
//wait until vector has stopped
until(motionStatus==1)
motionStatus=0
TRACE("finish
homing")
end function
// Motion Completed handler calls then a target position
reached.
function @motioncompleted(int busId, int objId)
global int motionStatus
if(objId == v1.vid)
motionStatus=1
TRACE( "Motion completed for object %", objId )
end
if
end function
// GroupMotionComplete
int motionStatus
function run()
global int motionStatus
motionStatus=0
sync(0,
10)
//send a sync signal to CAN bus 0 every 10ms
wait(10)
v1.detach()
g1.attach()
InitGroup(g1)
groupHoming(g1,0,100,200)
end function
function InitGroup(GROUP group)
global int motionStatus
int i
group.rm = 0
//The reference is generated by the interpreter
//command or by the user program.
group.mo = 0
wait(10)
group.sf = 0
group.um = 5
group.tr[1]=100
group.tr[2]=1
group.ll[2] = -833333
group.hl[2] = 833333
group.VH[2] = 750000
group.VL[2] = -750000
group.ll[3] = -1000000000
group.hl[3] = 1000000000
group.VL[3] = -999999990
group.VH[3] = 999999990
group.gmc=1
end function
function groupHoming(GROUP group, int
home_pos_x, int home_pos_y, int home_pos_z)
global int motionStatus
TRACE("homing group %", group.gid)
group[0].px = home_pos_x
group[1].px = home_pos_y
group[2].px = home_pos_z
group.mo = 1
group[0].pa = home_pos_x + 10000
group[1].pa = home_pos_y + 30000
group[2].pa = home_pos_z + 50000
group.bg
//wait until vector has stopped
until(motionStatus==1)
motionStatus=0
TRACE("finish
homing")
end function
// Motion Completed handler calls then a target
// position reached.
function @motioncompleted(int busId, int objId)
global int motionStatus
if(objId
==
g1.gid)
motionStatus=1
TRACE( "Motion completed for object %",
objId )
end
if
end function
Maestro
Software Manual
Appendix B: Sample Programs
MAN-MASSW (Ver. Q)
B-22