L297 stepper motor controller

Now I have knew the circuit of l297/l298 from the datasheet of them, but how can I connect it with the 89c51 if noly control the speed and direction of the motor.I think the direction of motor may be controlled using the pin17 of l297.Which pin should I use to control the speed, 18 or others?