beautypg.com

Subroutines, Timer interrupts – Maple Systems MAPware-7000 User Manual

Page 286

background image

286

MAPware-7000 Programming Manual

1010-1040, Rev. 02

Subroutines

Subroutines operate the same as the main program except they are not executed unless
specifically called on by another logic block. Subroutines are useful when you have a set of
commands that should be executed only under certain conditions.

A subroutine is activated using the CALL function (see the Instruction List). The CALL function
can be used in any logic block, including another subroutine:

Sample CALL function to subroutines

A maximum of 256 subroutines can be created (dependent upon total memory available).

To return to the calling logic block, you must end the subroutine program with a RET instruction:

Return (RET) instruction for subroutine

Timer Interrupts
Timer interrupt logic blocks are given the highest priority when the HMC7000 program is
executed. The timer interrupt is enabled by going to the Define…System Parameters dialog box
and checking Timer Interrupt Interval. When enabled, the timer interrupt routine is executed
based upon the interval selected (range is 1-1000 msec).

All other operations are suspended whenever the time interrupt activates. Use this feature if
you have a continuous operation that is time critical. Note that since timer interrupt routines
halt all other activities, it is best to minimize its impact on the performance of the controller by
using it sparingly. Design the interrupt routine to be as short as possible and adjust the timer
interrupt interval to be the maximum setting that can still meet the requirements of your
application. The end of the Timer Interrupt is recognized by the END instruction.