Difference between revisions of "Program Examples:Create Motion:Position Mode"

From SoftMC-Wiki
Jump to: navigation, search
Line 62: Line 62:
 
* [[MC-Basic:MOVE|MOVE Command]]
 
* [[MC-Basic:MOVE|MOVE Command]]
 
* [[EtherCAT:EC_SET_MOTION_OPMODE|EC_SET_MOTION_OPMODE]]
 
* [[EtherCAT:EC_SET_MOTION_OPMODE|EC_SET_MOTION_OPMODE]]
 +
* [[Program Examples:Create Motion:Velocity Mode|Velocity Mode - motion example]]
 +
* [[Program Examples:Create Motion:Torque Mode|Torque Mode - motion example]]

Revision as of 15:26, 6 November 2014

The following example demonstrates how to move an axis in Position Mode, using a MOVE Command.
Please notice the invocation of the subroutine EC_SET_MOTION_OPMODE that sets the axis and the drive to 'Position Mode'.
Refer to Axis Setup Procedure for an explanation and an example of how to set up an axis.

program

	attach a3
	attach a5

	call EC_SET_MOTION_OPMODE(a3, POSITIONMODE)
	call EC_SET_MOTION_OPMODE(a5, POSITIONMODE)

	a3.en=1
	a5.en=1
	
	sleep 1000
	
	while 1
	
		MOVE a3 25 vcruise=100 starttype=immediate abs = 1
		MOVE a5 -25 vcruise=100 starttype=immediate abs = 1

		while a3.IsMoving <> 0
			sleep 1000
		end while

		while a5.IsMoving <> 0
			sleep 1000
		end while

		MOVE a3 0 vcruise=100 starttype=immediate abs = 1
		MOVE a5 0 vcruise=100 starttype=immediate abs = 1
		
		while a3.IsMoving <> 0
			sleep 1000
		end while

		while a5.IsMoving <> 0
			sleep 1000
		end while
		
	end while

	detach a3
	detach a5
	
end program


The example corresponds to commit SHA-1: ba574128b365aebcd34f706e4c3a2c90762f7636 in GIT.


See Also