MX Foundation 4
Direct Signals Reading

The state of the discrete input lines can be read directly by the mxfFlexDIOChannelRead() function.

The example below shows how the mxfFlexDIOChannelRead() function can be used to read on one or multiple lines using a mask to get the input states.

Example

flexdio.c

uint32 rc;
HMXF_CHANNEL io=0;
uint64 i;
uint64 state;
...
// Read value of input pin #1 and set it to output pin #2 for about 10 seconds
for(i=0; i < 10000 && !rc; i++)
{
rc = mxfFlexDIOChannelRead(io, 0x02, &state);
state<<=1; // to be aligned with mask 0x04
state = ~state;
if(!rc)
rc = mxfFlexDIOChannelWrite(io, 0x04, state);
}
...
Updated 10/23/2023