![SEW-Eurodrive IPOS plus Manual Download Page 51](http://html1.mh-extra.com/html/sew-eurodrive/ipos-plus/ipos-plus_manual_1250042051.webp)
Manual – IPOSplus®
51
5
Variable interrupts with MOVIDRIVE
®
B
Task Management and Interrupts
Example solved in
the Compiler
Required parameter settings
P620 = IPOS output, P960 = for example SHORT
/*===========================================
IPOS source file
============================================*/
#include <constb.h>
#include <iob.h>
// necessary parameter settings:
// P620 = IPOS output, P960 = for example SHORT
VARINT hOPENvalve, hCLOSEvalve;
fnTask3()
{ //Task 3 is only needed to activate VarInt.
H1 = H1;
//dummy
command
}
fnOPENvalve()
{ //Switch on metering unit
Timer_2 = 0;
//Reset timer 2 to 0
hCLOSEvalve.Mode = 2;
//Activate
stop-IRQ
_SetVarInterrupt( hCLOSEvalve,fnCLOSEvalve );
_BitSet( StdOutpIPOS, 1 );
//Set
DO01
}
fnCLOSEvalve()
{ //Switch off metering unit
_BitClear( StdOutpIPOS, 1 );
//Delete
DO01
hCLOSEvalve.Mode = 0;
//Deactivate
stop-IRQ
_SetVarInterrupt( hCLOSEvalve,fnCLOSEvalve );
}
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{ //Initialization part
hOPENvalve.Control = 2; //Interrupt task3
hOPENvalve.IntNum
=0;
//continuous
no.
hOPENvalve.SrcVar = numof ( ModActPos ); //Modulo motor encoder
hOPENvalve.CompVar = 910;
// 5° on the machine = 5° x 910/65536
hOPENvalve.Mode = 12; // once when >= 5°
hOPENvalve.Priority = 6; // middle priority
hCLOSEvalve.Control
=
2;
//Interrupt
task3
hCLOSEvalve.IntNum = 1; //continuous no.
hCLOSEvalve.pSrcVar = numof ( Timer_2 ) ; //Timer 2
hCLOSEvalve.CompVar = 200; //deactivate after 200 ms
hCLOSEvalve.Mode = 0; //Deactivate timer-IR first
hCLOSEvalve.Priority = 7;
P
i
f
kVA
Hz
n
P
i
f
kVA
Hz
n