Programmable SyncPos motion controller
MG.10.J8.02 – VLT is a registered Danfoss trade mark
90
Input values
As in other programming languages the values in-
putted are not tested. Thus, it is the programmer’s
responsibility to ensure that extreme values do not
lead to problems. When searching for such potential
problems use the debug mode.
■
■
■
■
■
Interrupt
In general there are three types of interrupts:
ON INT
Interrupt at the edges
of an input
ON PERIOD / ON TIME
Interrupt after a certain
period of time
ON COMBIT / ON STATBIT
Interrupt when Bit n is
set
ON PARAM
Interrupt when a para-
meter n is changed
General processing of interrupt procedures
After every internal SyncPos command a query is
made whether an interrupt event has occurred. It is
important to remember that with every internal
SyncPos command the compiler creates a com-
mand in SyncPos machine code.
Thus, for example, a simple command such as:
POSA ( 1000)
is broken down into the following SyncPos machine
code:
MOVE
target
to register 101
MOVE immediate 1000 to register 102
ADDREG register 102 plus register 101 to
register 101
POSA axis to register 101
Furthermore, for commands which take longer (such
as DELAY or WAITAX) the program constantly
checks whether an interrupt event has occurred. If
this is the case, the command is interrupted and
continued once the interrupt has been processed.
NB!
Do not use WAITT in connection with inter-
rupts since the waiting process starts again
after the interruption.
Use of variables within interrupt procedures
The example above with the “SyncPos machine
code” clearly shows that it is necessary to use the
utmost care when assigning variables within inter-
rupt procedures.
If, for example, in the main program the following
assignment is made:
target
=
target
+ value – 1000
this is broken down into a series of SyncPos
machine code commands and the intermediate
results are stored in temporary registers. Only at the
end of the sequence is the result stored in
target
.
If during the execution of this command an interrupt
is triggered and in the corresponding procedure the
following command is executed:
target
= 0
then, in this instance, problems will arise. This is
because after processing the interrupt procedure
the program jumps back to the main program and
then the intermediate result which still exists is
stored in
target
: Thus, the 0 in
target
is overwritten
once again.
ON PERIOD
In contrast, for ON PERIOD functions the time when
the next call instruction should take place is calcula-
ted at the start of such a function, thus
START_TIME = TIME + PERIOD.
As soon as this time has been reached the function
is executed and subsequently the next start time is
calculated with the following formula
START_TIME = STAR PERIOD.
This ensures that the call intervals are really the
same since the execution time does not influence
the calculation. But this means that the user must
make sure that the period of time is actually longer
than the execution time as otherwise a “jam” is
created. That means that actually only the ON
PERIOD function is executed.
Programming with SyncPos