User Manual

TMCM-3230 TMCL
Firmware Manual Firmware Version V1.07 | Document Revision V1.05 2017-OCT-10
18 / 103
Interrupt number Interrupt type
41 Input change 2
42 Input change 3
43 Input change 4
44 Input change 5
45 Input change 6
46 Input change 7
255 Global interrupts
Table 11: Interrupt Vectors
3.5.6.2 Interrupt Processing
When an interrupt occurs and this interrupt is enabled and a valid interrupt vector has been dened
for that interrupt, the normal TMCL program ow 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, ags) 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.5.6.3 Further Conguration of Interrupts
Some interrupts need further conguration (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 3.6.7) for further information about that.
3.5.6.4 Using Interrupts in TMCL
To use an interrupt the following things have to be done:
Dene an interrupt handling routine using the VECT command.
If necessary, congure 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 ow 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 1000ms
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
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com