ElmoMC Multi-Axis Motion Controller-Maestro User Manual
Page 277
init()
// main loop
while(test())
//move()
moveTo()
end
while
end function
// Error handler calls then a runtime program
// error occur.
function @perror(int error)
// TODO: Add your error handling code here...
TRACE( "Error %", error )
end function
function [int retValue] = test()
global int go
if go == 0
retValue = 0
return
end
if
retValue = 1
end function
function init()
global int go
global float k
go=1
k=2
// init axis a1
if(a1.mo); a1.mo=0; end if
a1.um=5; a1.mo=1; a1.ac=a1.dc
// init axis a2
if(a2.mo); a2.mo=0; end if
a2.um=5;
a2.mo=1
a1.ac = a1.dc = a2.ac = a2.dc = 1000000
a1.sp = a2.sp = 50000
Set_offset.run()
end function
function move()
//Speed control
global float k
int
speed
if abs(m_ain[0]) < 100
speed=0
else
speed = m_ain[0] * k
end
if
if abs(a1.jv-speed) > 100
a1.jv
=
speed
a1.bg
end
if
if abs(m_ain[1]) < 100
speed=0
else
speed = m_ain[0] * k
end
if
if abs(a2.jv-speed) > 100
a2.jv
=
speed
a2.bg
end
if
end function
function moveTo()
//Position control
global float k
int
position
Maestro
Software Manual
Appendix B: Sample Programs
MAN-MASSW (Ver. Q)
B-25