hi,
i'm building a brrushless motor controller using 8051.here's the program i wrote.
#include<reg51.h>
#define port P0
int main(void)
{
int n=1000,i;
while(1)
{
port=0x90;
for(i=0;i<=n;i++);
if(n>200)
n--;
port=0x24;
for(i=0;i<=n;i++);
if(n>200)
n--;
port=0x48;
for(i=0;i<=n;i++);
if(n>200)
n--;
}
}
i don't know if it is efficient.but the program does'nt work completely.the motor starts with low speed,gains speed and then it starts squealing.the motor does'nt move.i can only hear the squealing.please help me debug.
thank you.
i'm building a brrushless motor controller using 8051.here's the program i wrote.
#include<reg51.h>
#define port P0
int main(void)
{
int n=1000,i;
while(1)
{
port=0x90;
for(i=0;i<=n;i++);
if(n>200)
n--;
port=0x24;
for(i=0;i<=n;i++);
if(n>200)
n--;
port=0x48;
for(i=0;i<=n;i++);
if(n>200)
n--;
}
}
i don't know if it is efficient.but the program does'nt work completely.the motor starts with low speed,gains speed and then it starts squealing.the motor does'nt move.i can only hear the squealing.please help me debug.
thank you.
Last edited: