tick interrupt for driving stepper motor at variable speed

I am trying to drive a stepper motor at various speeds through a stepper motor driver. I don’t want to bit bang because the program will do stuff while counting the pulses sent to the driver. how do i go about setting up a tick interrupt that would help me count to different values that can drive a stepper motor?

See the code for ShiftPWM, that contains examples of a timer driven interrupt service routine.

By the way you are using the term "bit banging" incorrectly, that is used for things like emulating serial, I2C or SPI protocols by discrete programming steps.

One approach is to use a phase accumulator - at each interrupt you add the "speed" value to the accumulator and if it wraps around then output a step. It needs the interrupt to run more often than the fastest stepping you need (actually a fair bit more often for smooth steps). And the phase accumulator and speed variables probably need to be at least 16 bits. The advantage is that the sketch can update the speed value whenever it likes and the interrupt routine just does the right thing. However you'll also need to keep track of the number of steps taken as well.

Another approach is to continuously update a timer's settings on each interrupt so that the delay to the next interrupt is varied - in this case the interrupt always does a step (unless speed == 0), and the speed value is used to calculate the delay.