Looking at the code you posted above it looks like you aren't using easyC. If you have access to easyC I would use the online window to look at the values being returned from the encoder.
You can also post at
vexforum.com and someone over there might be able to help.