Problem with reading encoder via serial communication

Hi,
I am trying to control the motor actuation based on encoder response via serial communication. I am getting response from motor but i cant able to get output from encoder. I checked the encoder separately which is working fine. Can anyone suggest me where i made mistake? I attached the code below please check and respond me as soon as possible.

Badhri_s_Firmware.ino (5.96 KB)

First off, you are getting this help for free from people who are volunteers so "respond me as soon as possible." is not nice.

Second, for short programs it is best to include the code directly in your Post. See How to use the Forum

Third, I can't quickly figure what your program is trying to do or how you are reading an encoder via serial. Post a link to the datasheet for your encoder.

Fourth, your getSerial() function is not robust as you make no attempt to ensure that there is any data available. How many characters do you expect to receive? Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

...R