Quantcast
Channel: Motor drivers forum - Recent Threads
Viewing all articles
Browse latest Browse all 15444

Control stepper motor using DRV8818 and MSP430G2553

$
0
0

Hello,

I'm using DRV8818 and MSP430G2553 to control the stepper motor 1.8 degree. Schematic I attach below. I write code for MSP430G2553 but it doesn't work, and I can't find out why. So I hope someone can help me? Here's my code:

#include <msp430g2553.h>
#define bit0    (0x01<<0)
#define bit1    (0x01<<1)
#define bit2    (0x01<<2)
#define bit3    (0x01<<3)
#define bit4    (0x01<<4)
#define bit5    (0x01<<5)
#define bit6    (0x01<<6)
#define bit7    (0x01<<7)

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;  // Stop WDT

  BCSCTL1 = CALBC1_16MHZ;
  DCOCTL = CALDCO_16MHZ;
  P1DIR |= 0x70;
  P1OUT |= 0x70;
  P1OUT &=~ bit5;
  P2DIR |= 0x3E;
  P2OUT |= 0x2E;
  P1DIR |= bit2;
  P1OUT &=~ bit2;
  __bis_SR_register(GIE);// enable global interrupt
   // Start Timer_A
   TA0CCR0 = 8000 -1;          // 1000Hz
   TA0CCR1 = 4000;
   TA0CCTL1 = OUTMOD_7;    //reset/set mode
   P1SEL |= bit2;
   TA0CTL |= TASSEL_2 + MC_1;// Start timerA0 in up mode , SMCLK
}

p1.2: Step; p1.4: Sleep; p1.5: Enable; p1. 6: Home

p2.1: Reset; p2.2: SRn; p2.3: USM0; p2.4: USM1; p2.5: DIR

(Please visit the site to view this file)


Viewing all articles
Browse latest Browse all 15444


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>