Your code takes 12.5 seconds to accelerate up to full speed. Then it goes into reverse. Why not take 12 seconds to bring it back down to zero speed first?
I think it might take a bit more experimenting with the DIP switches. Maybe you have it in "joystick mode" where 50% PWM is zero speed?