beautypg.com

B.3.10 program call, B.3.11 switch sample, B.3.12 while sample – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 264

background image

B.3.10 Program Call

// Homing with a Call
function run()

homing.x_pos

=

0

homing.y_pos = 0

homing.run()

v1.vtm=1 //enable PVT motion initialization

//create a line

sync(0,10)
v1.mo=1
v1.vsp=10000
v1.line(7000,

10000)

v1.bg

end function

int x_pos, y_pos
function run() //this the homing program

global int x_pos, y_pos

// standard Maestro homing procedure

a1.hm[2] = x_pos //receive position from calling

//function

a2.hm[2] = y_pos //receive position from calling

// function


a1.hm[3] = 0

a2.hm[3] = 0

a1.hm[4] = 0

a2.hm[4] = 0

a1.hm[5] = 0

a2.hm[5] = 0

a1.hm[1] = 1

a2.hm[1] = 1


end function

B.3.11 Switch Sample

function run()
int attribute, i

switch(attribute)
case

(1)

i=i+i

case

(2)

i=i*i

case

(3)

i=i/10

otherwise

TRACE ("Error attribute ")

end

switch

end function

B.3.12 While Sample

function run()
int attribute

while( attribute < 56)

attribute=attribute+17

TRACE("Attribute : %", attribute)

end

while

end function

Maestro

Software Manual

Appendix B: Sample Programs

MAN-MASSW (Ver. Q)

B-12