
;*************************************************************************
;This program performs feed and return 
;moves
;*************************************************************************

DEFINE	FeedSpeed   	2	;2 Rps
DEFINE	ReturnSpeed   	10	;10 Rps
DEFINE	FeedDistance 	10	;10 revs
DEFINE	AccelDecel	500		;500 Rps*S
DEFINE	ReturnDelay	500		;500 mS 

;-------------------------------------------------------------------------
;Following section ensures that hardware is configured properly for this 
;example functionality. If parameters are setup properly this code is not 
;needed
;-------------------------------------------------------------------------
	VAR_REFERENCE = 1	 ;select trajectory generator as positioning source
	VAR_DRIVEMODE = 2	 ;position mode
	VAR_ENABLE_SWITCH_TYPE=0 ;enable switch function set to "Enable only"
;-------------------------------------------------------------------------

;Set up motion parameters...

	UNITS =1				;set user units to revolutions
	ACCEL=AccelDecel		;acceleration = 50 Rps*s
	DECEL=AccelDecel		;deceleration = 50 Rps*s
	QDECEL=AccelDecel*100		;quick deceleration 100 times faster 

;*************************************************************************

	ENABLE		;enable drive
	V0=0
Again:	
	MAXV=FeedSpeed			;set feed speed
	MOVED FeedDIstance		;move  forward (feed)
	WAIT TIME ReturnDelay		;wait before return
	MAXV=ReturnSpeed		;set return speed
	MOVED  -FeedDIstance		;move reverse (return)
	Wait Time 2000
	GOTO Again			;loop execution 	
;
	END				;shouldn't get here anyway
 
