Manual – IPOSplus®
251
18
Querying an edge
Compiler – Examples
18.4.2 Example 2
In example 2, the program section within the if query is processed depending on the ris-
ing edge at DI02.
/*=============================================
IPOS source file
===============================================*/
#include <constb.h>
#include <iob.h>
long BinInputsNew, BinInputsOld;
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{
/*-------------------------------------
Initialization
--------------------------------------*/
/*-------------------------------------
Main program loop
--------------------------------------*/
while(1)
{
// Reading binary inputs
_GetSys( BinInputsNew,GS_INPUTS );
// Querying an edge
if( (BinInputsNew & 0x4) && !(BinInputsOld & 0x4) ) // rising edge DI02
{
// program statement is located here
}
// Saving input states
BinInputsOld = BinInputsNew;
}
}
P
i
f
kVA
Hz
n
P
i
f
kVA
Hz
n