While the transfer case shifts, the encoder within the electric-shift motor is monitored for the proper operating sequence. If during a shift, the encoder changes to an incorrect position, an error counter in the TCCM starts to count the number of times the encoder fails. If the encoder fails eight times, the TCCM produces a DTC of 2 indicating an Encoder Fault. When this happens, the TCCM outputs a signal in order to default the rail shift pattern in the encoder in order to allow for only shifts into 2HI and 4LO.
In order to protect against transient, random encoder faults caused by vibration, contamination, electrical noise, etc., the error counter reduces the count by one each time a good encoder value is detected. The encoder must fail 25 percent of the time for the TCCM to store a DTC of 2 and indicate a damaged encoder.
However, I'm still recommending that you have this diagnosed before repairing anything, as the encoder motor is several hundred dollars. Even if you have to pay a repair shop $75 to figure this out, it's a lot cheaper than being wrong by guessing at the encoder motor.
The pin 13 thing is not hard to figure out. If you'd like a hand with that, I'm sure I can help.