Changing the code to run faster - direct port manipulation HELP!

@Mikistromar, I find your description very confusing. It would help greatly if you could give a longer and more detailed description.

It sounds like you have suitable code to move your stepper motor as fast as you want.

It also sounds like you are trying to detect pulses from an encoder (what is it attached to?) but some of the encoder pulses are missed if you move the encoder too fast.

If the motor is working OK why are you using direct port manipulation to send it step pulses that are probably too short. Why not just use digitalWrite()?

Have you tried just reading the encoder without bothering with the motor until such time as you get the encoder reading correct?

Are you aware that it may be possible to move the encoder too fast for the motor, regardless of how cleverly the program is written. It may be necessary to count the encoder steps and then give the motor time to catch up. That would mean separating the reading of the encoder from the movement of the motor.

...R