MX Foundation 4
Direct Signals Reading

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

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

Example

discrete.c

uint32 rc;
HMXF_CHANNEL rx=0;
HMXF_CHANNEL tx=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 = mxfDiscreteChannelRead(rx, 0x02, &state);
state<<=1; // to be aligned with mask 0x04
if(!rc)
rc = mxfDiscreteChannelWrite(tx, 0x04, state);
}
...
Updated 10/23/2023