OK I read some more, and you do need to start with an even number.... Edit: Seeing as you are interested... This is the code that gets the pin status for the pair. The first pin number should be put into in W. The address of the beginning of the contents of the whole SR should be loaded into FSR1. (This is done by MIOS_DIN_2PinsGet when it is called from MIOS_ENC_Tick. This happens automatically when the encoder is moved.) The function checks the bits of the pin number after copying them to MIOS_PARAMETER1, and uses the bits to jump to the appropriate code (this is an optimisation which makes slightly bigger code which is much faster). These sections are specially designed to get pins 0+1,2+3,4+5,6+7 from each SR: MIOS_SRIO_Get2_Cont_Pin01, MIOS_SRIO_Get2_Cont_Pin23, MIOS_SRIO_Get2_Cont_Pin45, MIOS_SRIO_Get2_Cont_Pin67.... Then the specialised section of the function gets the pin values from the SR, and sets bits in W accordingly. At the very end W is copied to MIOS_PARAMETER1 for ease of use.