TMCM-1021 TMCL
™
Firmware Manual • Firmware Version V1.42 | Document Revision V1.10 • 2018-JAN-09
21 / 109
Interrupt number
Interrupt type
255
Global interrupts
Table 12: Interrupt Vectors
3.6.6.2
Interrupt Processing
When an interrupt occurs and this interrupt is enabled and a valid interrupt vector has been defined
for that interrupt, the normal TMCL program flow will be interrupted and the interrupt handling routine
will be called. Before an interrupt handling routine gets called, the context of the normal program (i.e.
accumulator register, X register, flags) will be saved automatically.
There is no interrupt nesting, i.e. all other interrupts are disabled while an interrupt handling routine is
being executed.
On return from an interrupt handling routine (RETI command), the context of the normal program will
automatically be restored and the execution of the normal program will be continued.
3.6.6.3
Further Configuration of Interrupts
Some interrupts need further configuration (e.g. the timer interval of a timer interrupt). This can be done
using SGP commands with parameter bank 3 (SGP <type> , 3, <value>). Please refer to the SGP command
(chapter
) for further information about that.
3.6.6.4
Using Interrupts in TMCL
To use an interrupt the following things have to be done:
• Define an interrupt handling routine using the VECT command.
• If necessary, configure the interrupt using an SGP <type>, 3, <value> command.
• Enable the interrupt using an EI <interrupt> command.
• Globally enable interrupts using an EI 255 command.
• An interrupt handling routine must always end with a RETI command.
• Do not allow the normal program flow to run into an interrupt handling routine.
The following example shows the use of a timer interrupt:
1
VECT 0, Timer0Irq
// define the interrupt vector
SGP 0, 3, 1000
// configure the interrupt : set its period to 1000 ms
3
EI 0
// enable this interrupt
EI 255
// globally switch on interrupt processing
5
// Main program : toggles output 3, using a WAIT command for the delay
7
Loop :
SIO 3, 2, 1
9
WAIT TICKS , 0, 50
SIO 3, 2, 0
11
WAIT TICKS , 0, 50
JA Loop
13
// Here is the interrupt handling routine
15
Timer0Irq :
GIO 0, 2
// check if OUT0 is high
17
JC NZ , Out0Off
// jump if not
©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at