Elmo HARSFEN0602 Automatic Routines Arbitration, Automatic Subroutine Mask, ##Loop, #@AUTOI3

Models: HARmonica HARSFEN0602

1 220
Download 220 pages 51.63 Kb
Page 51
Image 51

HARSFEN0602ElmoHARmonicaSoftwareManual

PRELIMINARYDRAFT

 

 

 

 

 

 

 

 

 

Called when a digital input #6 configured to the

 

 

 

AUTO_ I6

12

“GPI (General purpose Input)” function is

4096

 

 

 

 

activated. Refer the IL command.

 

 

 

 

Table 5-1 – Automatic subroutines and their priority

 

 

All the automatic routines, except AUTOEXEC, are activated only if a program is running.

Example:

Consider the program

##LOOP

**A go forever loop

gotoLOOP

 

#@AUTO_I3

**Subroutine definition

**Subroutine body

return

**Subroutine end

The forever loop in the first two lines of the routine is intended to make the program run forever, so that the automatic routine will be able to handle the digital input #3 event.

The #@AUTO_I3 routine will be called if digital input #3 is sensed and not masked.

The digital input #4 will not invoke any automatic action in the user program, since no #@AUTO_I4 routine is defined to handle digital input #3 event. A user has an option for explicit call of an automatic routine, if it is desired. The syntax for an auto routine call is the same as for a user function.

5.6.9.2Automatic Routines Arbitration

Priority and pending automatic routines

Each automatic subroutine has its assigned priority, according to Table 5-1 above.

When the conditions to the activation of two implemented automatic subroutines arise simultaneously the automatic subroutine with the higher priority will be called.

The other automatic subroutine will be marked as pending. It will execute at the first time it has the permission to execute – even if the reason for its call does not exist any more.

5.6.9.3The Automatic Subroutine Mask

Automatic subroutines may be masked, i.e. set inactive. For example, it may be desired to limit the automatic response to a certain digital input will be limited to certain situations.

This is done using the MI command.

Example:

An amplifier is commanded by a PLC. The Amplifier has an autoexec routine, which activates its program upon boot. The PLC sends instructions to the Amplifier using RS232 communication for task parameters and a digital input to start an action immediately. The Amplifier sets output according to the state of the program. For safety, the Amplifier is not allowed to perform any task before digital input 2 is set:

function autoexec ()

**Declare the autoexec function

mi=8;

**Inhibit the routine #@AUTO_I1

op=1;

**Set output to indicate start.

….

 

while (!IB[2])

** Wait for setting the digital input 2

end

 

goto #@TEST_PARS;

**Jump to subroutine

##LOOP

**Label LOOP

**Label LOOP body

49

Page 51
Image 51
Elmo HARSFEN0602, HARmonica software manual Automatic Routines Arbitration, Automatic Subroutine Mask, ##Loop, #@AUTOI3