B.4.6.2 motioncompletetest, B.5 homing, Wall homing – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 275: B-23, B.5.1 wall homing

Advertising
background image

B.4.6.2 MotionCompleteTest

int g_iMC
// Entry point of the application.
function run()

// TODO: Global Variables Declaration

inside the Function...

global int g_iMC

// TODO: Local Variables Declaration...

int

iTimes,i

int

T1,T2

int

iPos1,iPos2

// TODO: Add your specialized code here...

g_iMC

=

0

iTimes

=

11

InitAxis(a1)
InitAxis(a2)
homing(a1,

0)

homing(a2,

0)

iPos1

=

100000

iPos2

=

10000

for i=0: iTimes

AxisMoving(a1,

iPos1)

iPos1 = iPos1 * (-1)

AxisMoving(a2,

iPos2)

iPos2 = iPos2 * (-1)

AxisMoving(a2,

iPos2)

iPos2 = iPos2 * (-1)

end

for

end function

function homing(AXIS axis, int home_pos)

global int g_iMC

int

iTR_1

int

iTR_2

g_iMC

=

0

axis.TR[1]

=

100

axis.TR[2]

=

0

axis.px = home_pos

axis.mo

=

1

wait(20)

axis.pa = home_pos

axis.bg

until(axis.aid == g_iMC)

end function

function AxisMoving(AXIS axis, int pos)

global int g_iMC


axis.pa = pos

axis.bg

until(axis.aid == g_iMC)

g_iMC=0
end function


// Motion Completed handler calls then a target
// position reached.
function @motioncompleted(int busId, int objId)

global int g_iMC

g_iMC

=

objId


//

TRACE( "Motion completed for object %", objId )

end function

function InitAxis(AXIS axis)
axis.mo

=

0

axis.amc = 1

axis.rm = 0

//The reference is generated by the interpreter
//command or by the user program.
wait(10)

axis.sf = 0

axis.um = 5 //set unit mode


// set velocity and position limits

axis.ll[2]

=

-833333

axis.hl[2] = 833333

axis.VH[2] = 750000

axis.VL[2]

=

-750000


axis.ll[3]

=

-1000000000

axis.hl[3] = 1000000000

axis.VL[3]

=

-999999990

axis.VH[3] = 999999990

axis.sp

=

200000

end function

B.5 Homing

B.5.1

Wall Homing

// This routine is used to home from a "wall"
int g_iAxisNum

function run()

global int g_iAxisNum

int TimeOut

Maestro

Software Manual

Appendix B: Sample Programs

MAN-MASSW (Ver. Q)

B-23

Advertising