User guide
Chapter 5. Custom Profiling
171
Program
DEF PROFIL ; Define motion profile program
VAR10 = 4000 * VAR4 ; Get distance of first stage
; (assuming 4000 steps/revolution)
D(VAR10) ; Set distance
V(VAR1) ; Set velocity of first stage
POUTA.1-1 ; Turn output 1 on
GOBUF1 ; Build motion
VAR10 = 4000 * VAR5 ; Get distance of second stage
D(VAR10) ; Set distance
V(VAR2) ; Set velocity of second stage
POUTA01 ; Turn output 1 off and output 2 on
GOBUF1 ; Build motion
VAR10 = 4000 * VAR6 ; Get distance of third stage
D(VAR10) ; Set distance
V(VAR3) ; Set velocity of third stage
POUTAx01 ; Turn output 2 off and output 3 on
GOBUF1 ; Build motion
POUTA.3-0 ; Turn off output 3
END ; End motion profile program
DEF EXMPL1 ; Define program example 1
L ; Continual loop of program execution
DCLEAR0 ; Clear all lines on RP240 display
DPCUR1,1 ; Position cursor at line 1, column 1
DWRITE"ENTER VELOCITY STAGE 1" ; Prompt user
VAR1 = DREAD ; Get 1st velocity from RP240 entry
DCLEAR1 ; Clear line 1 on RP240 display
DPCUR1,1 ; Position cursor at line 1, column 1
DWRITE"ENTER VELOCITY STAGE 2" ; Prompt user
VAR2 = DREAD ; Get 2nd velocity from RP240 entry
DCLEAR1 ; Clear line 1 on RP240 display
DPCUR1,1 ; Position cursor at line 1, column 1
DWRITE"ENTER VELOCITY STAGE 3" ; Prompt user
VAR3 = DREAD ; Get 3rd velocity from RP240 entry
DCLEAR1 ; Clear line 1 on RP240 display
DPCUR1,1 ; Position cursor at line 1, column 1
DWRITE"ENTER REVOLUTIONS STAGE 1" ; Prompt user
VAR4 = DREAD ; Get # of windings 1st stage from RP240 entry
DCLEAR1 ; Clear line 1 on RP240 display
DPCUR1,1 ; Position cursor at line 1, column 1
DWRITE"ENTER REVOLUTIONS STAGE 2" ; Prompt user
VAR5 = DREAD ; Get # of windings 2nd stage from RP240 entry
DCLEAR1 ; Clear line 1 on RP240 display
DPCUR1,1 ; Position cursor at line 1, column 1
DWRITE”ENTER REVOLUTIONS STAGE 3" ; Prompt user
VAR6 = DREAD ; Get # of windings 3rd stage from RP240 entry
PCOMP PROFIL ; Re-compile profile with new vel/dist info
$AGAIN ; Label for repeating same profile
PRUN PROFIL ; Execute profile
DCLEAR1 ; Clear line 1 on RP240 display
DPCUR1,1 ; Position cursor at line 1, column 1
DWRITE"SAME DATA (1=YES,2=NO)" ; Prompt user if perform again with old data
VAR7 = DREAD ; Get response
IF(VAR7=1) ; If user wants to perform same profile
GOTO AGAIN ; perform again
NIF ; End conditional
LN ; End command execution loop
END ; End definition program example 1
; ******************************************
; * To begin, execute the EXMPL1 program *
; ******************************************










