EasyManua.ls Logo

SEW-Eurodrive IPOS plus - Querying an Edge; Example 1

SEW-Eurodrive IPOS plus
384 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Manual – IPOSplus®
249
18
Querying an edge
Compiler – Examples
18.4 Querying an edge
18.4.1 Example 1
In addition to the level of an input terminal, the rising and falling edge can also be queries
and evaluated. In the following sample programs, output DO02 is toggled to DI02 for a
positive or negative edge.
Positive edge query
#include <const.h> // MOVIDRIVE A
#include <io.h> // MOVIDRIVE A
// Variables for edge generation
long lDI02RisingEdge,
lDI02LastState,
lDO02State,
lInputLevel;
main()
{
while(1)
{
// Read DI02
lInputLevel = (InputLevel & 0x00000004);
// Generate edge DI02
lDI02RisingEdge = lInputLevel && (lDI02LastState);
lDI02LastState = lInputLevel;
if(lDI02RisingEdge)
lDO02State = (!lDO02State)
// Set output DO02
if (lDO02State)
_BitSet( StdOutpIPOS, 2 );
else
_BitClear( StdOutpIPOS, 2 );
}
}
P
i
f
kVA
Hz
n
P
i
f
kVA
Hz
n

Table of Contents