beautypg.com

B.2 motion mathematics, B.3 basic programming, B.3.1 break-continue-return sample – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 261: B.3.2 function call sample, B.3.3 for sample

background image

v1.addline ( -128000, 64000 )

v1.addcircle( 64000,180,-90 )

v1.vse

=

0

v1.ends()

//finish building trajectory

wait(10)
v1.bg

//start

motion

end function

B.2 Motion Mathematics

Refer to the Motion Library Tutorial which can be viewed on the Elmo web site at

http://www.elmomc.com/support/Samples-Tutorial/MAN-MLT.pdf

.

B.3 Basic Programming

B.3.1

Break-Continue-Return Sample

//The "continue" statement forces immediate transfer of control to the
// next iteration of the loop.

//The "break" statement is used to exit the loop.

//The "return" statement ends the current function
// (and transfers control back to the calling function)

function run()
int

i,j

for

i=1:2:20

if (i%2 == 0)

j=i/2

continue //go to next iteration

else if (i%4 == 0)

j=i/4

break

//exit

the

loop

else

j=i

return

//exit this function

end

if

i=i+1

end

for

j=j+i
end function

B.3.2

Function Call Sample

function run()
int

multipleVar

multipleVar=multiple(10,15)

//call embedded function "multiple"

end function //after returning from the called function (multiple),

//multipleVar=150

function [int c] = multiple(int a, int b)

// this func has two input parameters (a and b)

// and one output parameter (c)

c=a*b

end function

B.3.3

For Sample

function run()

int i, a

a=0

Maestro

Software Manual

Appendix B: Sample Programs

MAN-MASSW (Ver. Q)

B-9