Hi,
i was trying to read my absolute 24 bit encoder with arduino Nano , i've been using rs422 to ttl converter to get values, encoder got 2 data wires, 2 clock wires and +5 V
My take - You're using unsigned long almost everywhere. One place it's not used is in the return type of readPosition(), which is shown as int. I'd try making readPosition()'s return type unsigned long so it matches the other variable types.