User Manual

PD42-1240 TMCL
Firmware Manual Firmware Version V1.45 | Document Revision V1.02 2018-DEC-03
21 / 132
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
SIO 0, 2, 1 // switch OUT0 high
19
RETI //end of interrupt
Out0Off:
21
SIO 0, 2, 0 // switch OUT0 low
RETI //end of interrupt
In the example above, the interrupt numbers are being used directly. To make the program better readable
use the provided include le Interrupts.inc. This le denes symbolic constants for all interrupt numbers
which can be used in all interrupt commands. The beginning of the program above then looks as follows:
#include Interrupts.inc
2
VECT TI_TIMER0 , Timer0Irq
SGP TI_TIMER0 , 3, 1000
4
EI TI_TIMER0
EI TI_GLOBAL
3.5.7 New TMCL Commands
In order to make several operations easier, the following new commands have been introduced from
rmware version 1.45 on. Using these new commands many taks can be programmed in an easier way.
This can save some code, thus making a TMCL program shorter, faster and easier to understand.
Please note that these commands are not available on PD42-1240 modules with rmware versions before
1.45. So please make sure that at least rmware version 1.45 is installed before using them.
New TMCL Commands
Mnemonic Command number Meaning
CALCVV 40 Calculate using two user variables
CALCVA 41 Calculate using a user variable and the accumulator
CALCAV 42 Calculate using the accumulator and a user variable
CALCVX 43 Calculate using a user variable and the X register
CALCXV 44 Calculate using the X register and a user variable
CALCV 45 Calculate using a user variable and a direct value
©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com