Interrupts
To increment macro responsivity to external conditions, EMCL implements a macro interrupt system, allowing for greater flexibility in motion controller application development. The macro interrupt system comprises 12 interrupt sources with their corresponding vectors, 4 of which are general purpose inputs, allowing to re-route other signals to this inputs for additonal flexilibity in choosing the interrupt source.
Whenever the interrupt source is triggered, the current macro that is being executed and the accumulator value are saved into the so-called macro stack, and the execution of the macro specified by the interrupt vector table entry begins. The procedure is similar to the macro call procedure, only this time triggered by an asynchronous, external source. Interrupt vector table entries simply determine which macro is to be called upon the detection of a particular event.
The interrupt enabling procedure is as follows: the user must set the Interrupt vector - 0x2C07 register in the SubIndex position relative to the desired interrupt vector with the value of the macro to be called upon the detection of the specified event. If an interrupt is generated and that vector table entry has not been defined (is equal to 0), then the interrupt will not be executed. Obviously, the macro 0 can not be used as an interrupt routine, since it is the boot sector for the stand-alone system. Once the macro to be executed upon the desired event has been defined, an interrupt is generated only if the Interrupt enable - 0x2C08 register SubIndex associated with the event is set. Once an interrupt is generated, this flag is automatically cleared, to avoid continous interrupt triggering. Therefore, the user should, if applicable, re-enable the interrupt before exiting the interrupt macro to be able to catch future interruptions from this source.
The following table describes all possible interrupt sources:
Interrupt vector | Interrupt source |
| Interrupt vector | Interrupt source |
17 | HS_GPI2 Falling Edge (only in custom projects) | |||
16 | HS_GPI2 Rising Edge (only in custom projects) | |||
15 | HS_GPI1 Falling Edge (only in custom projects) | |||
14 | HS_GPI1 Rising Edge (only in custom projects) | |||
13 | Drive Error (only in custom projects) | |||
12 | Following error detected |
| 6 | Timer 2 overflow |
11 | HS_GPI2 state enabled |
| 5 | Timer 1 overflow |
10 | HS_GPI1 state enabled |
| 4 | GPI4 state enabled |
9 | User i2t exceeded |
| 3 | GPI3 state enabled |
8 | Timer 4 underflow |
| 2 | GPI2 state enabled |
7 | Timer 3 underflow |
| 1 | GPI1 state enabled |