Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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.

stepper motorprogramming using msp430

Status
Not open for further replies.

karthickb3e

Advanced Member level 4
Joined
Dec 13, 2010
Messages
101
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
INDIA
Activity points
1,883
hi all,
I am newbie to msp430 and stepper motor...... i need sample program for stepper motor (bipolar) control program for reverse and forward direction.. please any one share program using MSP430 (in C/C++ language)
 
Last edited:

Hello!

Let's suppose your chip is wired to a FET H bridge and that you can drive
4 outputs low or high using one port.
For instance, if you use port 1, and assuming that coil A + corresponds to
P1_0, A- to P1_1, B+ to P1_2, and B- to P1_3, then you may want to write:

#define COILA_P 0x01
#define COILA_N 0x02
#define COILB_P 0x04
#define COILB_N 0x08

P1DIR = 0x0F; // Allow P1 pins 0 to 3 to output
P1OUT = 0. // Disable everything.

uint8 step[4] = {COILA_P, COILB_P, COILA_N, COILB_N}; // Step sequence for bipolar motor to go forewards

uint8 crt_step = 0; // Current step index;
while(1) {
P1OUT = step[crt_step++];
if(crt_step == 4) crt_step = 0;
delay(some_delay);
}

It should spin...
Now if you change cry_step++ to cry_step--, then it should go backwards. In this case, don't forget
to change the next line to if(crt_step == 255) crt_step = 0;
And from there, you can have myriads of variants with half-steps, sine / cosine steps, etc...

Dora.
 
thank u very much my friend...i not yet purchased the controller and the driver.. can u suggest the msp 430 controller and the h-bridge driver............
also share if any sample program u have or useful link
 

Hello!

I cannot tell you, it depends on the other functionality of your program. If you
just want to test a stepper motor, then you need 4 output pins and a launchpad
might be enough.

In my case, I used a 5510 because I wanted analog inputs and I also wanted
the possibility to upgrade the firmware by USB. The 5510 is quite cheap.

As for the H bridge, I cannot tell you. It depends on what power you need.

Dora.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top