beautypg.com

ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 160

background image

One of following command sequences can implement profile position motion.

• Motion organization without callback using:

Example 1.1

function run()
int

val

sync( 0, 10 )

//work with DS402 motion object required sync mechanism

a1.opm=1

//select operation mode for axis a1


a1.ato=10000

//statusword waiting timeout

a1.prv=2000

//set profile velocity

a1.pac=10000000

//define acceleration

a1.pdc=10000000

//define deceleration

a1.qsdc=10000000

//define quick stop deceleration

a1.psw=100

//define position windows

a1.pswt=2

//define position windows time

a1.mo=1

//motor on command

a1.pa=0

//set absolute target position value

a1.bg

//start

motion

val=a1.awm

//wait for motion completed

if( (val&1024) == 1024)

//bit 10 of SW is ON for target reached

a1.prv=5000

//set profile velocity

a1.ptp=2000

//set profile target position

a1.snp

//apply new target position
//with current velocity, acceleration, ect.

a1.bg

//start

motion

a1.awm

//wait for motion complete event

end if

a1.mo=0

//motor off command

end function


• Motion organization with callback using:

int g_nStatus
function run()

global int g_nStatus

//global variable definition

sync( 0, 10 )

//work with DS402 motion object required sync mechanism

a1.opm=1

//select operation mode for axis a1


a1.prv=2000

//set profile velocity

a1.pac=10000000

//define acceleration

a1.pdc=10000000

//define deceleration

a1.qsdc=10000000

//define quick stop deceleration

a1.psw=100

//define position windows

a1.pswt=2

//define position windows time

a1.mo=1

//motor on command

g_nStatus=0

//global variable initialization

a1.amc=1

//motion callback mechanism ON

Maestro

Software Manual

DS402 Command Reference

MAN-MASSW (Ver. Q)

10-15