Lenze PMSS1000 Simple Servo Manuel d'utilisateur Page 25

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 72
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 24
Indexer-Programmer-Manual.pdf REV 1.3
On the other hand, MDV statement execution never suspends the program because each individual
statement sets portions of motion profile. Every motion profile or portion of (in case of MDV statement)
generated by motion statements MOVEP,MOVED or MDV first go to motion stack and than executed one
by one. In the other hand if statement doesn't have ",C" modifier motion profile generated by this
statement goes to motion stack and program suspended until this profile has been executed.
1.11 Subroutines and Loops
Subroutines
Often it is necessary to repeat a series of steps in several places in a program. Subroutines can be useful
in such situations. The syntax of a subroutine is simple. Subroutines must be placed after the main
program (after END statement), must start with subname: label (where subname is name of subroutine),
and must end with a statement RETURN.
Note that it can be more than one RETURN statement in a subroutine. Subroutines are called using the
GOSUB statement.
Loops
SML language supports WHILE/ENDWHILE block statement which can be used to create repetition
loops. Note that IF-GOTO statements can also be used to create loops.
Following example shows a subroutine called MDS and WHILE/ENDWHILE block statement to implement
looping.
DEFINE LOOPCOUNT V1
DEFINE LOOPS 10
DEFINE dist V2
DEFINE repetitions V3
repetitions=0
MainLoop:
LOOPCOUNT=LOOPS
dist=10
WHILE LOOPCOUNT ;inner performs LOOPS times
dist=dist/2
GOSUB MDS ;Call to subroutine
WAIT 100 ;this executes when returned
;from subroutine
LOOPCOUNT=LOOPCOUNT-1 ;decrement loop counter
ENDWHILE
repetitions=repetitions+1 ;outer loop
IF repetitions < 5
goto main
ENDIF
END
;-------------------Main program End---------------------------------
;--------------------------------------------------------------------
;Motion subroutine
;----------------------------------------------------------------------------
--
MDS:
V4=dist/3
MDV V4, 10
MDV V4,10
MDV V4,0
RETURN
25
Vue de la page 24
1 2 ... 20 21 22 23 24 25 26 27 28 29 30 ... 71 72

Commentaires sur ces manuels

Pas de commentaire