
48
Manual – IPOSplus®
5
Interrupts for MOVIDRIVE
®
A and B
Task Management and Interrupts
5.6.4
Timer0 interrupt
The entire interrupt routine is run through once when the timer has elapsed (=0). After
one run-through, an Assembler command from task 1 is processed before the system
checks whether the time = 0. Once the condition is fulfilled, processing branches back
to the interrupt routine.
The cycle time can be set in variable H485 T0_Reload to trigger a timer0 interrupt at
equal intervals. This cycle time is used to reload the timer0 automatically when it occurs
in the interrupt routine
This results in the following options:
• If a program section is to be processed at equal intervals with the timer0 interrupt,
the timer0 must be reloaded with the T0_Reload, for example.
• If a program section is to be run through once with the timer0 interrupt at a defined
time after IPOS has been started, the timer0 must be set to -1 in the interrupt.
Sample
fnTimerInterrupt()
{
H0 = H0 +1;
T0_Reload = 10000; //Reload timer 0 automatically with 10 s
_SetInterrupt( SI_TIMER0,fnTimerInterrupt); // Activate interrupt
}
main()
{
while (1) {H1 = H1 +1;}
}
H0 is increased by 1 every 10 s.
INFORMATION
Since the timer0 counts backwards, the interrupt condition would be fulfilled perma-
nently if T0_Reload = 0 and the value of the timer has not been changed in the inter-
rupt routine.
P
i
f
kVA
Hz
n
P
i
f
kVA
Hz
n