Here's a simple algorithm that uses conventional microcontroller blocks to control commercially available H-bridges to properly commutate a bipolar stepper motor through a microstepping profile.