
MCO 305 Design Guide
__ Software Reference __
MG.33.L4.02 – VLT
®
is a registered Danfoss trademark
133
ON INT . . GOSUB
Summary
Defining an interrupt input
Syntax
ON INT n GOSUB name
Parameter
n =
number of the input to be monitored; (input area –8 … 8 and FC 300
inputs 18 … 33 and –33 … –18)
positive input numbers (1 … 8) = reaction to the rising edge
negative input numbers (–1 … 8) = reaction to the falling edge
name =
subroutine name
Description
By using the ON INT GOSUB instruction, a subroutine must be defined which will
be called up when an edge is detected at the monitored input.
A maximum of one subroutine per input can be defined. It is not possible to define
an interrupt for the falling and the rising edges of the same input
This definition can take place at any time. If, following this definition, a corres-
ponding interrupt occurs, then the accompanying subroutine is called up and pro-
cessed. After the last subroutine command (RETURN), the program will continue
from the point of interrupt.
NB!:
The ON INT GOSUB instruction should be at the start of the program, so that it has
validity for the entire program.
The subroutine to be called up must be defined within the SUBMAINPROG and
ENDPROG identified program.
The identification of an interrupt and the call up of the corresponding subroutine
requires a maximum of 2 milliseconds. Interrupt from FC 300 input add additional
2 ms, in worst case.
A minimal signal length of 1 ms is necessary for the sure identification of a level
change! The chapter input/output terminal contains more information concerning
the input circuit and input technical data.
NB!:
–
The instruction for ON INT GOSUB is edge and not level triggered.
–
During the execution of a subroutine called by an interrupt NOWAIT is
automatically set to ON.
Priority
If a number of interrupts occur simultaneously, the subprogram assigned to the
lowest bit is worked through first. The other interrupts will be processed after-
wards. If, during an interrupt subroutine, the same interrupt occurs (exception:
error interrupt), then it will be ignored and thus lost.
Command Group
INT
Cross Index
SUBPROG..RETURN, ON ERROR .. GOSUB, WAITI, DISABLE interrupts, ENABLE
interrupts, Priorities of Interrupts, NOWAIT
Syntax Example
ON INT 4 GOSUB posin
/* Definition of Input 4 (positive edge) */
ON INT –5 GOSUB negin
/* Definition of input 5 (negative edge) */
command line 1
command line n
SUBMAINPROG
/* subroutine must be defined */
SUBPROG
posin
command line 1
command line n
RETURN
SUBPROG
negin
command lines 1 … n
RETURN
ENDPROG
Program Sample
ONINT_01.M,
DELAY_01.M
Summary of Contents for MCO 305
Page 4: ......