B.3.4 global variable sample, B.3.5 if sample – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 262

Advertising
background image

for i=10:-2:-10

//iterate i from 10 to -10 in -2 increments

a=a+i*2

end

for

end function

B.3.4

Global Variable Sample

// File GlobalVar.maxl
// Global Variables Declaration...
int a,b

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

//Global variable declaration inside function body

//specified by global keyword.

global int a, b

int c

// local variable declaration in function run()


c=56
b=16
a=c+b

end function

// File GlobalVarUse.maxl created 30.01.2005 14:51:09
int pos_x, pos_y // Global Variables Declaration...

function
run()

global int pos_x, pos_y

//Global Var. Declaration inside a Function...

pos_x = 1000

pos_y = 2000

v1.vsp

=

3000

initialization()
v1.line(5000,

10000)

v1.bg
end function

function initialization()

// Global Variables Declaration inside the Function...

//global int pos_x, pos_y

sync(0,20)

//synchronize CAN devices

v1.mo=0

//motor off

a1.px=pos_x

//start point of Axis 1 is 1000

a2.px=pos_y

//start point of Axis 2 is 2000

v1.mo=1

//motor on

v1.vum=1

//max velocity mode

end function

B.3.5

If Sample

function run()

int a, b

a=7
b=10

if (a < b+5)

a=a+2

end

if

b=b-2
end function

Maestro

Software Manual

Appendix B: Sample Programs

MAN-MASSW (Ver. Q)

B-10

Advertising