关于28BJY—48步进电机的问题?
时间:10-02
整理:3721RD
点击:
我使用的是28BJY—48步进电机,使用4相8拍你的脉冲控制方式,步距角应该为5.625度,但为什么我的步进电机我只给了它128个脉冲,它就转动了一圈?
程序如下:
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code step_table[] = {0xfe,0xfc,0xfd,0xf9,0xfb,0xf3,0xf7,0xf6};
void delay(uchar z)
{
uchar x,y;
for(x = 114; x > 0; x--)
for(y = z; y > 0; y--);
}
void main()
{
uchar i = 0;
uint j = 128;
for(j = 128; j > 0; j--)
{
for(i = 0; i < 8; i++)
{
P1 = step_table[i];
delay(20);
}
}
while(1);
}
程序如下:
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code step_table[] = {0xfe,0xfc,0xfd,0xf9,0xfb,0xf3,0xf7,0xf6};
void delay(uchar z)
{
uchar x,y;
for(x = 114; x > 0; x--)
for(y = z; y > 0; y--);
}
void main()
{
uchar i = 0;
uint j = 128;
for(j = 128; j > 0; j--)
{
for(i = 0; i < 8; i++)
{
P1 = step_table[i];
delay(20);
}
}
while(1);
}