Introduction And Basics; Fundamental Program Layout; Fundamental Command Structure - Danfoss VLT5000 SyncPos Operating Instructions Manual

Motion controller for danfoss vlt5000 series; danfoss vlt 5000flux series
Table of Contents

Advertisement

■ ■ ■ ■ ■ Programming with SyncPos
■ ■ ■ ■ ■ Fundamental Program Layout
• • • • • Definitions: Arrays, Interrupts, User
parameters
• • • • • Initializing: Setting parameters, flags and
variables
• • • • • Main program loop
main:
GOTO main
• • • • • Sub program area
SU B MAI NPROG
SUBPROG name
R ETU R N
E NDPROG
Definitions
Array
DIM send[12], receive[12]
Interrupt ON ERROR GOSUB errhandle
ON INT –1 GOSUB stopprog
ON PERIOD 500 GOSUB calc
ON TIME 10000 GOSUB break
User parameters
LINKAXPAR SYNCACCURACY 710
"ACCURACY [qc]" 0 100000 0
LINKGPAR 133 716 "Offset [qc]" 0
100000 0
Initializing
Parameters
SET POSERR 100000000
SET 133 10000
SETVLT 205 50
Flags/variables
offset = 0
sync_flag = 0
System parameters VEL 100
ACC 100
DEC 100
Main program
main:
IF (IN 3 == 1) THEN
/* Go into synchronizing mode, if input 3 = 1 */
GOSUB syncprog
E LS E
GOSUB speedprog
/* If input 3 not = 1, run in speed mode */
GOTO main
MG.10.J8.02 – VLT is a registered Danfoss trade mark
Programmable SyncPos motion controller
Sub programs
SU BMAINPROG:
SUBPROG syncprog
IF (sync_flag ==0) THEN
/* synchronize, if not already synchronized */
SYNCP
sync_flag = 1
E ND IF
RETURN
SUBPROG errhandle
WAITI 18 on
/* waiting for digital input 18, clear the error */
sync_flag = 0
ERRCLR
R ETU R N
E NDPROG
Sequential command processing
In general a command is processed to the end
before a new command is begun. This means that
for position commands the program waits until the
target position has been reached.
Exception: If NOWAIT has been set to ON.
■ ■ ■ ■ ■ Fundamental Command Structure
All instructions consist of: COMMAND WORD +
possible Parameter
Parameter. . . . . A variable can also be used
Parameter
Parameter
Parameter
as parameter instead of an absolute number.
Example
POSA 10000
or
pos = 10000
POSA pos
Command run times
If the command execution times are critical in an
application it is possible to measure the run times
of a command sequence under the different ope-
rating conditions using the command TIME.
Tips for Increasing Program Readability
• • • • •
Use of capital and small initial letters (i.e. all
commands capital letters, all variables small).
• • • • • Placement of spacing between command
parts.
• • • • • Place comments in your program. The com-
ments are between
/* ... */ or after //...
/* Begin COMMENT End */
// Begin COMMENT End
Inadmissible is nesting comments (/* ... ... ... ... ... /*... ... ... ... ...*/)
• • • • • Use of line identification within the loop.
89

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents