Hi everyone,
I had a problem to control a stepper motor with L293D.
I had connected my stepper motor in following way.
http://www.8051projects.net/stepper-mot ... tepper.gif
And I used IO(1~4) as output to control the stepper motor.
The following code is to generate pulse to drive the motor.
#include "coridium.h"
#include "cor_init.h"
#include "cor_hwlib.h"
#include "cor_wrflash.h"
#include "mem.h" // not used here, included only for reference
#include "string.h"
#include "printf.h"
#include "constants.h"
//#define USE_FLOAT
#ifdef USE_FLOAT // for the LPC175x you must also add to USERargs "-mfpu=vfp"
#include
#endif
int main(void)
{
init_coridium(); // REQUIRED OPERATION
OUTPUT(15);
LOW(15);
while (1) {
printf("Send pulse");
OUTPUT(0);
HIGH(0);
OUTPUT(1);
OUTPUT(2);
OUTPUT(3);
OUTPUT(4);
for (i=0; i<1000; i++) {
HIGH(1);LOW(2);LOW(3);LOW(4);
WAIT (5);
LOW(1);LOW(2);HIGH(3);LOW(4);
WAIT (5);
LOW(1);HIGH(2);LOW(3);LOW(4);
WAIT (5);
LOW(1);LOW(2);LOW(3);HIGH(4);
}
}
return 0;
}
L293D Datasheet
http://www.st.com/stonline/products/lit ... s/1330.pdf
However, my stepper motor is not doing anything at all.Does anyone spot
any problem of my code or connection?
Stepper motor with L293D
-
- Posts: 1462
- Joined: Fri Oct 19, 2012 5:11 am
Re: Stepper motor with L293D
Missing a wait after the last step.
Try lengthening the wait.
Like always if all else fails, check the wiring.
Try lengthening the wait.
Like always if all else fails, check the wiring.