wiki:Docs/Prog/Manual/ApplicationLibraries/lib825ev/IO/SetOutputMask

Version 2 (modified by Don Wilson, 12 years ago) ( diff )

--

SetOutputMask

Set the output states of one or more digital outputs to ON or OFF for the main board or a DIO option card.

int SetOutputMask(int bd, uint32 mask, uint32 output);

Parameters

  • bd - 0 for main board or number of digital output card
  • mask - bit mask to specify which outputs will be affected
  • output - bit mask to specify state of outputs

Return Value

  • Returns the result - OK success

Remarks

The main board or option card must already be opened by calling OpenMnBd first. The call does a wait for acknowledgement. If the application is using main board communication events these events may be called during the wait for acknowledgement.

Examples

// Affect outputs 1 - 3 Mask = 1 + 2 + 4 = 7
if(SetOutputMask(MNBD_DEV, 7, 4) == OK)
    DisplayText(0, 0, "Out 3 set to ON 1 and 2 set to OFF");
// Affect outputs 1 - 4 Mask = 1 + 2 + 4 + 8 = 15 decimal = 0x0F hexadecimal
// Set 1 and 2 on = 1 + 2 = 3
if(SetOutputMask(MNBD_DEV, 0x0F, 3) == OK)
    DisplayText(0, 0, "1 and 2 ON  - 3 and 4 OFF");

See Also

Note: See TracWiki for help on using the wiki.