PID tuning with quadrature encoder

Currently, I am working on the PID position control of linear motion with quadrature encoder. The coding can read the input pulse given and make respond. However, it does not feed to the input position I wanted and it stop in a random pulse. I don’t know why this happen? Can anyone explain to this. I have attached my coding. Please enlighten me with your knowledge. I need the answer as soon as possible. Thank you.

testing_2.ino (3.48 KB)

munson0829:
Currently, I am working on the PID position control of linear motion with quadrature encoder.

Yeah, we know.
You told us in this topic's two clones, now happily deleted.

Do not cross-post, cross-posting wastes time.