Hard disk motor controller using microcontroller

hi everyone,

i'm building a motor controller(mainly hard disk).i'm using an 89C51 microcontroller.i wrote a program which did'nt work.i built a mosfet array to drive the delta connected motor.here's the program that i did.i don't know if it is efficient,correct and such details.please help me build a proper program.

#include<reg51.h>
#define pin1 P1

int main(void)
{
 int n=500,i;
 while(1)
  {
    pin1=0x80;
    for(i=0;i<=n;i++);
    pin1=0x80;
 for(i=0;i<=n;i++);
    
     if(i>1)
     n--;
  
   
    pin1=0x40;
    for(i=0;i<=n;i++);
    pin1=0x40;
    for(i=0;i<=n;i++);
 
   if(i>1)
      n--;
 
 
 pin1=0x20;
    for(i=0;i<=n;i++);
    pin1=0x20;
    for(i=0;i<=n;i++);
 
 if(n>1)
      n--;
  } 
}

 

 

thank you

rik did this

He did it without the micro controller but he did show a lot of his math in the post which should help you bunches.

https://www.robotshop.com/letsmakerobots/chill/view/54?page=1

yes i saw that, i aleady did

yes i saw that, i aleady did that and want to do it with a microcontroller

uC

Just like I advised. Or would have. I forgot.
Sorry Jay, I don’t speako the Arduino.
Yet.