Dear all;
I try to move 2 motor with L298N motor driver card and MSP430G2553. I tried some basic codes, but right motor does not work. When I give energy to right motor can move. So, problem is not in motor. But, when I tried to move both motors only one motor can move (the motor that is driven by IN1 and IN2. I added code to below. I can not find my error. Could you help me please?
#include
int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer DCOCTL=CALDCO_1MHZ; BCSCTL1=CALBC1_1MHZ; P1DIR |= BIT6; //Set pin 1.6 to the output direction. P1SEL |= BIT6; //Select pin 1.6 as our PWM output. TA0CCR0 = 255; //Set the period in the Timer A0 Capture/Compare 0 register to 255
TA0CCTL1 = OUTMOD_7; TA0CCR1 = 255; TA0CTL = TASSEL_2 + MC_1; //TASSEL_2 selects SMCLK as the clock source, and MC_1 tells it to count up to the value in TA0CCR0.
P1DIR|=BIT1+BIT2+BIT3+BIT4; P1OUT|=BIT1+BIT3; P1OUT&=~(BIT2+BIT4);
} BIT1=IN1; BIT2=IN2; BIT3.=IN3; BIT5=IN4;
Both enable pins are connected P1.6 PWM output. I hope you can provide information. Regards.
--------------------------------------- Posted through