2 automatic routine arbitration, 3 the automatic subroutine mask – ElmoMC SimplIQ Software Manual User Manual
Page 61

SimplIQ
Software Manual
4BThe
SimplIQ
User Programming Language
MAN-SIMSW (Ver. 1.4)
5-32
5.8.9.2 Automatic Routine Arbitration
Each automatic routine has an assigned priority, according to
. When the
conditions for activating two automatic subroutines occur simultaneously, the automatic
subroutine with the higher priority is called. The other automatic subroutine will be marked
as pending and will execute at the first opportunity in which it receives permission to
execute, even if the reason for its call does not exist any more.
5.8.9.3 The Automatic Subroutine Mask
Automatic subroutines can be masked, to indicate that they are inactive. For example, it may
be desirable to limit the automatic response to a certain digital input to certain situations.
This is carried out using the MI command.
Example:
A drive receives a PLC command. It has an autoexec routine that activates its program upon
boot. The PLC sends instructions to the drive using RS-232 communication for task
parameters and a digital input to start an action immediately. The drive sets the output
according to the state of the program. For safety sake, the drive is not allowed to perform
any task before digital input 2 is set.
function autoexec ()
Declare the autoexec function.
MI=128;
Inhibit the routine #@AUTO_I1.
OP=1;
Set output to indicate start.
…
while (!IB[2])
Wait for digital input 2 to be set.
End
goto #@TEST_PARS
; Jump
to
subroutine.
##LOOP
Label
LOOP
.
… Label
LOOP
body.
goto **LOOP;
Endless
loop.
#@TEST_PARS
Subroutine.
OP=2;
Set output 2.
wait 2000;
Wait 2 seconds for testing the part.
MI=0;
Enable automatic handling of digital input #1.
goto ##LOOP;
return
End of automatic function.
#@AUTO_I1
Automatic handler for digital input #1.
OP=3;
Set output 3 to indicate that digital input #1
is sensed.
… Subroutine
body.
return
Subroutine
end.
…
exit
Exit
program.