If I have helped, please press my 'helped' button to improve my status in the forum.
I am writing a motor control progam at the moment using Pic18F4431.
It is in C using mcc18 2.4 compiler and mplab7. I use the ICD2 for debugging.
I am working away from home at the moment and only back at weekends.
So I can't answer unless it's a weekend.
I can edit my source code and share with you the core functions for driving the motor. Simple 6 step commutation. I can not share all as it is a commercial product and therefor copyright. The motor has 8 magnets, 4 pole pairs and uses Hall sensors at 60 degrees.
Motor control is quite big in industry at the moment with some esotoric methods being developed for greater power and efficiency such as Field Orientated Control using Clarke and Park transforms in real time using dsp based proccessors. (dsPic)