public void SetDO(int port, bool status) { var p = port; if (p < 0) { return; } if (p < 16) { N.GT_SetDoBit(card, Api.MC_GPO, (short)(p + 1), status.ToInt16()).Verify(); return; } p -= 16; if (p < 8) { N.GT_SetDoBit(card, Api.MC_ENABLE, (short)(p + 1), status.ToInt16()).Verify(); return; } p -= 8; if (p < 8) { N.GT_SetDoBit(card, Api.MC_CLEAR, (short)(p + 1), status.ToInt16()).Verify(); return; } }