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

From SoftMC-Wiki
Jump to: navigation, search
(Created page with "The following example demonstrates how to move an axis in Position Mode, using a MOVE Command.<br/> Please notice the invocation of the subroutine [[EtherCAT...")
 
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
{{Languages|Program_Examples:Create_Motion:Position_Mode}}
 
The following example demonstrates how to move an axis in Position Mode, using a [[MC-Basic:MOVE|MOVE Command]].<br/>
 
The following example demonstrates how to move an axis in Position Mode, using a [[MC-Basic:MOVE|MOVE Command]].<br/>
 
Please notice the invocation of the subroutine [[EtherCAT:EC_SET_MOTION_OPMODE|EC_SET_MOTION_OPMODE]] that sets the axis and the drive to
 
Please notice the invocation of the subroutine [[EtherCAT:EC_SET_MOTION_OPMODE|EC_SET_MOTION_OPMODE]] that sets the axis and the drive to
Line 21: Line 22:
 
while 1
 
while 1
 
 
move a3 25 vcruise=100 starttype=immediate abs = 1
+
MOVE a3 25 vcruise=100 starttype=immediate abs = 1
move a5 -25 vcruise=100 starttype=immediate abs = 1
+
MOVE a5 -25 vcruise=100 starttype=immediate abs = 1
  
 
while a3.IsMoving <> 0
 
while a3.IsMoving <> 0
Line 32: Line 33:
 
end while
 
end while
  
move a3 0 vcruise=100 starttype=immediate abs = 1
+
MOVE a3 0 vcruise=100 starttype=immediate abs = 1
move a5 0 vcruise=100 starttype=immediate abs = 1
+
MOVE a5 0 vcruise=100 starttype=immediate abs = 1
 
 
 
while a3.IsMoving <> 0
 
while a3.IsMoving <> 0
Line 53: Line 54:
  
  
The example corresponds to commit SHA-1: 0013794b23d0976ecda4ac880eac706c4d3e34bb in GIT.
+
The example corresponds to commit SHA-1: ba574128b365aebcd34f706e4c3a2c90762f7636 in GIT.
  
  
Line 62: Line 63:
 
* [[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]]

Latest revision as of 05:45, 17 July 2017

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