B.3.13.5 drill machine, B-14 – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 266

Advertising
background image

B.3.13.5

Drill Machine

//Axis X name a1
//Axis Y name a2
//Axis Z name a3

// TODO: Global Variables Declaration...
//declaration of N dimension array
ArrayName[size0,size1,....,sizeN]
int arrX[10]

//declaration of one dimension array
//Arrayname[size]

int arrY[10]
int arrZ[10,10] //declaration of two dimension array

//ArrayName[size0,size1]

int speedXY
int speedZ
// Entry point of the application.

function run()
// TODO: Global Variables Declaration inside the
Function...
global int arrX[]
global int arrY[]
global int speedXY
global int speedZ
// TODO: Local Variables Declaration...
int indX,indY
sync(0,40)
speedXY = 10000
speedZ = 30000
indX = 0
indY = 0
// TODO: Add your specialized code here...
homing(a1,0)
homing(a2,0)
homing(a3,0)
CreateDrilTable()//for test this program only

a3.sp = speedZ

for

indX=0:(arrX.size-1)

for

indY=0:(arrY.size-1)

DrilPos(indX,indY)
end

for

end

for

end function

function InitAxis(AXIS axis)
global int speedXY
axis.mo

=

0

wait(10)

axis.rm = 0

//The reference is generated by the interpreter

//command or by the user program.

axis.sf = 0

axis.um = 5

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 = speedXY

end function

function homing(AXIS axis, int home_pos)
InitAxis(axis)
// axis.mo

=

0

// wait(10)

axis.px = home_pos

axis.mo

=

1

wait(10)

axis.pa = home_pos

axis.bg
end function

function DrilPos(int IndX,int IndY)
//Global Variables Declaration inside the Function...

global int arrX[]

global int arrY[]

global int arrZ[]

global int speedZ

int

posZ

posZ = arrZ[IndX,IndY]

if(posZ==0)
return
end

if


// table X/Y moving

a1.PA

=

arrX[IndX]

a2.PA = arrX[IndY]

V1.bg
while

(a2.ms==2||a1.ms==2)

wait(10)
end

while

//axis Z to position according index X and index Y

a3.PA = posZ

a3.bg
while

(a3.ms==2)

wait(10)
end

while

//axis Z back to pos=0

a3.PA = 0

a3.bg
while

(a3.ms==2)

wait(10)
end

while

end function

function CreateDrilTable()
global int arrX[]
global int arrY[]
global int arrZ[]
int ind
for

ind=0:(arrX.size-1)

arrX[ind]

=

10000*ind

arrY[ind]

=

10000*ind

end

for

arrZ[1,1] = 20000
arrZ[2,2] = 10000
arrZ[3,3] = 20000
arrZ[5,5] = 10000
arrZ[9,9] = 10000

end function

Maestro

Software Manual

Appendix B: Sample Programs

MAN-MASSW (Ver. Q)

B-14

Advertising