|
楼主 |
发表于 2013-2-22 00:32:29
|
显示全部楼层
郁闷 电机不转。 程序如下:
while(1)
{
GPIO_SetBits(GPIOC, GPIO_Pin_6); //enable
for(i=0;i<1000; i ++)//wait enable stable
{
b++;
}
if(flag == TRUE)
{
GPIO_SetBits(GPIOC, GPIO_Pin_7); //dir +
flag = FALSE;
}
else
{
GPIO_ResetBits(GPIOC, GPIO_Pin_7);
flag = TRUE;
}
for(i=0;i<1000; i ++)//wait dir stable
{
b++;
}
for(t_high_max = 72*10000;t_high_max>72;t_high_max-=1)
{
GPIO_ResetBits(GPIOC, GPIO_Pin_10); //pulse state low
for(t_low=100;t_low>0; t_low--)//pulse low time
{
b++;
}
GPIO_SetBits(GPIOC, GPIO_Pin_10); //pulse state high
for(t_high=2000;t_high>0; t_high--)//pulse low time
{
b++;
}
}
for(t_high_max = 72*10;t_high_max<72*10000;t_high_max+=1)
{
GPIO_ResetBits(GPIOC, GPIO_Pin_10); //pulse state low
for(t_low=100;t_low>0; t_low--)//pulse low time
{
b++;
}
GPIO_SetBits(GPIOC, GPIO_Pin_10); //pulse state high
for(t_high=2000;t_high>0; t_high--)//pulse low time
{
b++;
}
}
OSTimeDly(3000);// hold 3 second.
}
本来是想正反转来回切 有变快和变慢,结果根本就不动。
现在电机的现象是:
先上24V电机和驱动器供电, 然后再单片机板上电。 这个是我的上电顺序。
发现无论单片机板上不上电, 电机都不转,用手也转不动。
单片机上电后手摸电机轴上的塑料片有微弱震感。
无论接不接单片机,贴上去听,电机能听到哗啦哗啦类似电视模拟时代没台时候的噪音,非常小的噪音。
加电半天, 电机摸上去微温。
|
|