2016-08-29 04:08 AM
Hello i am trying to launch simple stepper (
http://robocraft.ru/files/datasheet/28BYJ-pdf
) using l293d.Connecting 28byj-48 to the L293D:
Engine contact 1is connected to the
output 1. Enginecontact
3is connected to the
output 2. Enginecontact
4is connected to the
output 3. Engine contact 2is connected to the
output 4. Connecting STM32to the
L293D:
PC1 is connected to input 1. PC3 is connected to the input 2. PC5 is connected to the input 3. PC7 is connected to the input 4.Enable 1, Enable 2 , Vs, Vss connected to 5v.
As a result, i hear some noise from motor but it do not spin. Dear forum users tell me what am I doing wrong?
Thank you.
#include ''stm32f10x.h''
#include ''stm32f10x_gpio.h''
#include ''stm32f10x_rcc.h''
void Delay(unsigned int t)
{
unsigned int i;
for (i=0;i<t;i++);
}
void GPIOD_Initialize(){
GPIO_InitTypeDef GPIOC_Stepper;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
GPIOC_Stepper.GPIO_Pin=GPIO_Pin_1|GPIO_Pin_3|GPIO_Pin_5|GPIO_Pin_7;
GPIOC_Stepper.GPIO_Mode=GPIO_Mode_Out_PP;
GPIOC_Stepper.GPIO_Speed= GPIO_Speed_50MHz;
GPIO_Init(GPIOC,&GPIOC_Stepper);
}
int main(void)
{
GPIOD_Initialize();
while(1)
{
GPIO_Write(GPIOC,GPIO_Pin_1);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_1| GPIO_Pin_3);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_3);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_5|GPIO_Pin_3);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_5);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_5|GPIO_Pin_7);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_7);
Delay(100);
GPIO_Write(GPIOC,GPIO_Pin_7|GPIO_Pin_1);
Delay(100);
}
}
2016-08-30 04:58 PM
Hearing noise but not turning can be (among other things):