Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] stepper motor interface

Not open for further replies.


Junior Member level 3
Mar 31, 2011
Reaction score
Trophy points
Activity points
Hello guys
i am trying to interface P89v51 rd2 controller with stepper motor. i had bought the stepper motor with drive. please see the specification of
stepper motor in below mentioned link.

Stepper motor:
**broken link removed**

Diver details:
**broken link removed**

i am trying to establish serious connections using this motor and driver and i need to interface with micro controller to rotate the motor in clockwise and anti clock wise direction.

i tried programming the motor as normal stepper motor but it doesn't work. like
sbit Coil_A = P2^0;		// R
sbit Coil_B = P2^1;		// O
sbit Coil_C = P2^2;		// B
sbit Coil_D = P2^3;		// G
void main()
 P2   = 0x00;

//Coil_A = 1;
Coil_A = 1;
Delay (1000);

// Coil_A = 0;
Coil_A = 0;

Coil_B = 1;

Coil_C = 0;
Coil_D = 0;
i would be really great full if someone give solution for this. thanks in advance

I'm not even sure that the step sequence that you are trying to implement is correct but in this case this step logic is implemented inside the driver.
All you have to do is send the logic signals:
connect your mcu as shown below, you can use three transistors or sink the output directly if your mcu can sink 16mA,then use ENA to enable the driver, select the direction from DIR and send a pulse to PUL for each step



IT seems like to drive the motor i need to frequency in the range of 200khz. and is that possible to obtain 200khz in MCU if means can u say how to achieve it?
And you have mentioned that send the pulse to PUL. if you dont mind can u say how to generate the pulse from MCU pls give some examples in term of programming to give pulse to driver.

The pulses are send for each step, why do you need 200000 steps /sec?
An mcu can switch the output fast enough , it depends on the rest of the code how much speed you will get but it should be high enough.
The simplest way is to toggle a pin, I haven't used your mcu so I can't give you specific instructions


It's is similar to 8051 or 89c51 MCU. when i contacted the motor supplier he told that the motor will only get drive it the output frequency is n the range of 200khz. From investigation from other sources i found , i need to pass some value with pulse signal to run the motor. i dono how to pass the value through pulse signal. for that reason only i have some example programs to pass the pulse

You have been misinformed, there in no need (or way) to pass info to the driver, all the settings are done with the dip switches.
You only have to set the direction and send one pulse for one step, that is all, the datasheet is quite clear on that
There in no need for a high frequency either, you do a step whenever you want , you can do a step per hour if you wish.


Well thanks for the clearance.. can u pls look at the above code which i had attached ...can u say whether i a m going in a rite way or not.. if not can u direct me in rite way please

The pulses can be generate even from a simple code like P2^1; , every time it is used it will invert bit0 of port2 so every two times you get a step,

or you can use

P2 &= ~(1); // set pin0 to 0
P2 |=1; // set pin0 to 1

set the dir from another bit, this should be stable for 5ms before you send a step pulse
P2 |=2; // set pin1 to 1 for CW rotation
P2 &= ~(2); // set pin1 to 0 for CCW rotation

you can connect the enable pin (ENA) externally or in an mcu pin too
P2 |=4; // set pin2 to 1 to enable the driver
P2 &= ~(4); // set pin2 to 0 to disable the driver

Will you connect the driver directly to the mcu?
can your mcu pin sink 10-16mA for each pin?

Not open for further replies.

Part and Inventory Search

Welcome to