B.4.4 emitcallback samples, B.4.4.1 emit, B-16 – ElmoMC Multi-Axis Motion Controller-Maestro User Manual

Page 268

Advertising
background image

TRACE(

"Fin"

)

end function

// Heartbeat handler calls then a CAN node state was be changed.
function @hbevent(int busId, int nodeId, int nodeState)
global

int

work

switch(

nodeState

)

case( 0 )

TRACE( "Node % : Boot Up State", nodeId )

case( 127 )

TRACE( "Node % : Pre Operation State", nodeId )

case( 5 )

TRACE( "Node % : Operation State", nodeId )

case( 4 )

TRACE( "Node % : Stopped", nodeId )

case( -1 )

TRACE( "Node % : No heartbeat", nodeId )

end

switch

work = nodeState


end function

B.4.4

EmitCallback Samples

B.4.4.1 Emit

int go

function run()
global int go
init()

// run conveyer program

switch

conv.ps

case

-1

//

progrma

exists

conv.XQ## // run axis program

case

-2

TRACE("Error: Conveyer axis has not program!!!")

exit

end

switch

conv.ape = 8 // listen emit on PDO 4

home(stamp)

// main program loop

go = -1

while

go!=0

until

go!=-1

if go == 1

stamp.pr=5000
stamp.bg
until

stamp.ms==0

stamp.pr=-5000
stamp.bg
until

stamp.ms==0

go

=

-1

end

if

end

while

end function

// Emit handler calls then a runtime SimplIQ program emit occur.
// Emit handler initialization:
//

ape=0x01 for emit(1),

//

ape=0x04 for emit(3),

//

ape=0x08 for emit(4)

//

or any combination: ape=0x04|0x08 for emit(3) and emit(4).

function @emit(int busId, int nodeId, int data)

Maestro

Software Manual

Appendix B: Sample Programs

MAN-MASSW (Ver. Q)

B-16

Advertising