PWM question

I am using an arduino to control a stepper and I'm having some difficulties reaching the speeds required. I tried sort of doing a manual PWM to create the step pulses:

digitalWrite(stepPin, HIGH); delay(dly); digitalWrite(stepPin,LOW); delay(dly);

But I can't seem to attain a frequency nearly high enough (my steady state speed needs to be about 1000 steps/s). Through searching I found that it is possible to change the frequency of the PWM that arduino puts out. I should be able to use this to create my pules, however, I haven't seen anyone vary the frequency within the void loop which is something that I would love to be able to do to create some type of an acceleration profile. I know it may not be possible but I figured I'd ask to see if anyone has any ideas.

(my steady state speed needs to be about 1000 steps/s

So the value in the delay need to be 0.5mS, however the shortest you can get with delay is 1mS so the fastest speed you can get like this is 500Hz. It's slower than that in reality because the write takes time as well.

I tried sort of doing a manual PWM to create the step pulses:

If you feed PWM signals into a stepping motor you will not control it's speed.

Look at the arduino code in the RepRap project for how to accelerate a stepping motor with an arduino.