I I I I I Programming With Syncpos Fundamental Program Layout; Fundamental Command Structure - Danfoss VLT 5000 Series Manual

Synchronizing and positioning option onizing and positioning option
Hide thumbs Also See for VLT 5000 Series:
Table of Contents

Advertisement

I I I I I Programming with SyncPos
I I I I I Fundamental Program Layout
• • • • • Definitions: Arrays, Interrupts, User
parameters
• • • • • Initializing: Setting parameters, flags and
variables
• • • • • Main program loop
main:
GOTO main
• • • • • Sub program area
SUBMAINPROG
SUBPROG name
RETURN
ENDPROG
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
ELSE
GOSUB speedprog
/* If input 3 not = 1, run in speed mode */
GOTO main
MG.10.J4.02 – VLT is a registered Danfoss trade mark
®
VLT
5000 SyncPos option
Sub programs
SUBMAINPROG:
SUBPROG syncprog
IF (sync_flag ==0) THEN
/* synchronize, if not already synchronized */
SYNCP
sync_flag = 1
ENDIF
RETURN
SUBPROG errhandle
WAITI 18 on
/* waiting for digital input 18, clear the error */
sync_flag = 0
ERRCLR
RETURN
ENDPROG
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.
I I I I I Fundamental Command Structure
All instructions consist of: COMMAND WORD +
possible Parameter
Parameter
Parameter
Parameter. . . . . A variable can also be used
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.
61

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents