Program Examples:Create Motion:Position Mode

From SoftMC-Wiki
Jump to: navigation, search
Language: English  • 中文(简体)‎

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