This looks awefully complex for getting the value of a few digital input bits. We have a BCD switch that is connected to the digital input channels 11, 12, 13 and 14. We have one statement to get all the digtal input bits and a macro to massage the bits to the right value.
Code:
#define BCDSwitchValue(x) (((~(x)) >> 2) & 0x0f)
UINT32 startingPosition = BCDSwitchValue(m_digitalIn->GetDIO());