This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Driving a unipolar stepper motor with a ULN2003 and MSP430G2553 using PWM

Hello

I've just worked through the Launchpad tutorial and am pretty impressed as I had no knowledge of this level of programming before and now I know at least some of the basic concepts. i can see years of fun ahead ! My ULN2003 controller has 4 inputs and I want to drive each one in the standard way, sending a pulse to each input sequentially. I used grace and ccs to start off. Now I'm lost as grace seems to allow only one output pin, while I need to drive the 4 pins. How should I proceed ?

  • The MSP PWM works through its tiemr units. A timer supports one PWM frequency (defined by its input clock and teh CCR0 value) and up to 6 PWM outputs which are synchronized: their DC starts at the same moment but ends at different moments which are defined by the CCR1-CCR6 units.
    However, if your MSP only has a TimerA with two CCR units, then there is only one PWM output.

    Also, since all PWM outputs are synchronized (if your MSP has more than one), you don't have a way to define different phase for the pulses. They will either start or end simultaneously.

    (there is a way to do it anyway, but it requires reprogramming each CCR twice per cycle in toggle/reset mode, and is rather advanced stuff - and has tight timing requirements)

    For your approach, it is better to configure the tiemr to trigger an interrupt with the interval of you phase shift between the pulses, then write an ISR that is called when the timer expires and which manually toggles four different I/O pins.
    To have the same latency for all events, some clever (symmetrical) coding is required.

    On MSPs with a DMA module, you can use the DMA, triggered by the timer, to handle the port changes. This will minimize the latency. However, the LaunchPad won't offer this.

**Attention** This is a public forum