MX Foundation 4
Sending IO signals

The state of the discrete output lines can be directly set by the mxfDiscreteChannelWrite() function.

The example below shows how the mxfDiscreteChannelWrite() function can be used to set the state of one discrete output line.

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