Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #26298 > unrolled thread
| Started by | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| First post | 2017-03-26 22:49 -0500 |
| Last post | 2017-03-29 06:22 -0500 |
| Articles | 15 — 3 participants |
Back to article view | Back to comp.arch.embedded
L298 PWM Problem "engineergc" <116985@EmbeddedRelated> - 2017-03-26 22:49 -0500
Re: L298 PWM Problem "engineergc" <116985@EmbeddedRelated> - 2017-03-26 23:07 -0500
Re: L298 PWM Problem Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2017-03-27 14:39 +0300
Re: L298 PWM Problem Tim Wescott <tim@seemywebsite.com> - 2017-03-27 11:49 -0500
Re: L298 PWM Problem "engineergc" <116985@EmbeddedRelated> - 2017-03-29 06:15 -0500
Re: L298 PWM Problem Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2017-03-29 14:34 +0300
Re: L298 PWM Problem "engineergc" <116985@EmbeddedRelated> - 2017-03-29 07:00 -0500
Re: L298 PWM Problem "engineergc" <116985@EmbeddedRelated> - 2017-03-29 07:04 -0500
Re: L298 PWM Problem Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2017-03-29 18:58 +0300
Re: L298 PWM Problem Tim Wescott <tim@seemywebsite.com> - 2017-03-29 11:19 -0500
Re: L298 PWM Problem Tim Wescott <tim@seemywebsite.com> - 2017-03-29 11:32 -0500
Re: L298 PWM Problem Tim Wescott <tim@seemywebsite.com> - 2017-03-27 11:50 -0500
Re: L298 PWM Problem Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2017-03-27 21:12 +0300
Re: L298 PWM Problem "engineergc" <116985@EmbeddedRelated> - 2017-03-29 05:52 -0500
Re: L298 PWM Problem "engineergc" <116985@EmbeddedRelated> - 2017-03-29 06:22 -0500
| From | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| Date | 2017-03-26 22:49 -0500 |
| Subject | L298 PWM Problem |
| Message-ID | <nNWdnYfD--B_FkXFnZ2dnUU7-LvNnZ2d@giganews.com> |
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 <msp430.h>
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 http://www.EmbeddedRelated.com
[toc] | [next] | [standalone]
| From | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| Date | 2017-03-26 23:07 -0500 |
| Message-ID | <NcOdnT0VesiSDUXFnZ2dnUU7-RXNnZ2d@giganews.com> |
| In reply to | #26298 |
>Dear all;
>
>I try to turn 2 motors with pwm by using L298N motor driver card and
MSP430G2553. I tried some codes, but right motor does not work. When I
give direct energy from a supply to right motor without using motor
driver or micrroprocessor it can turn. So, problem is not in motor. But,
when I tried
>to turn both motors by using MSP430 launchpad and L298N only one motor
can turn (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 <msp430.h>
>
>int main(void) {
> WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
> DCOCTLÊLDCO_1MHZ;
> BCSCTL1ÊLBC1_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 http://www.EmbeddedRelated.com
---------------------------------------
Posted through http://www.EmbeddedRelated.com
[toc] | [prev] | [next] | [standalone]
| From | Tauno Voipio <tauno.voipio@notused.fi.invalid> |
|---|---|
| Date | 2017-03-27 14:39 +0300 |
| Message-ID | <obatgd$mnq$1@dont-email.me> |
| In reply to | #26298 |
On 27.3.17 06:49, engineergc wrote:
> 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?
>
(Code clipped, TV)
1. It does not speed up a response to send the same question
multiple times. It may annoy potential responders.
2. There is no way to answer to your questions without the
schematic diagrams of the electronics.
3. This has a strong smell of homework / school project. Is it?
--
-TV
[toc] | [prev] | [next] | [standalone]
| From | Tim Wescott <tim@seemywebsite.com> |
|---|---|
| Date | 2017-03-27 11:49 -0500 |
| Message-ID | <q7ydnQ8IucYK30TFnZ2dnUU7-fWdnZ2d@giganews.com> |
| In reply to | #26306 |
On Mon, 27 Mar 2017 14:39:42 +0300, Tauno Voipio wrote: > On 27.3.17 06:49, engineergc wrote: >> 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? >> >> > (Code clipped, TV) > > 1. It does not speed up a response to send the same question > multiple times. It may annoy potential responders. Indeed. > 2. There is no way to answer to your questions without the > schematic diagrams of the electronics. Or at least a pin-by-pin description of the signals you're sending out, including the frequency of the PWM signal. -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
[toc] | [prev] | [next] | [standalone]
| From | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| Date | 2017-03-29 06:15 -0500 |
| Message-ID | <-_WdnZ8_Oa3YCkbFnZ2dnUU7-WHNnZ2d@giganews.com> |
| In reply to | #26312 |
>On Mon, 27 Mar 2017 14:39:42 +0300, Tauno Voipio wrote:
>
>> On 27.3.17 06:49, engineergc wrote:
>>> 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?
>>>
>>>
>> (Code clipped, TV)
>>
>> 1. It does not speed up a response to send the same question
>> multiple times. It may annoy potential responders.
>
>Indeed.
>
>> 2. There is no way to answer to your questions without the
>> schematic diagrams of the electronics.
>
>Or at least a pin-by-pin description of the signals you're sending out,
>including the frequency of the PWM signal.
>
>--
>Tim Wescott
>Control systems, embedded software and circuit design
>I'm looking for work! See my website if you're interested
>http://www.wescottdesign.com
Hi Tim,
I send same question two time because edit option is not exist. In
first time I made some gramer mistakes therefore I wanted to correct them,
since edit option is not available I added fixed form of my question as
comment.
I draw pin connections by using Fritzing program. but I can not add it
to here. How I can add my schematic to here?
Since I can not add schematic I made pin connections description
below.
P1.1>>IN1
P1.2>>IN2
P1.3>>IN3
P1.4>>IN4
P1.6>>ENA&ENB(I connected pwm output to both ENA and ENB pins of L298
motor driver card.
Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 connectors as
respectively.
Then, GND of MSP430 and gnd of 9V battery are connected to GND connector
of L298.
By using this code or another code I can not turn both motor
simultaneously.Only one motor can turn.
***SECOND CODE***
Also I tried many another codes. I added one of them to below. In this
code I adjusted frequency of motor as 20 khz. If frequency is equal to 20
khz, period of motor is equal to T=1/f=1/20000 50us. I used clock source
as SMCLK. SMCLK is supplied from DC0 and DCO is adjusted to 1MHZ.
Therefore I write TA0CCRO=50 and I adjusted TA0CCR1=30.
#include <msp430.h>
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
DCOCTL=CALDCO_1MHZ;
BCSCTL1=CALBC1_1MHZ;
P1DIR |=BIT2; //PWM output
P1SEL |=BIT2;
TA0CCR0 = 50;
TA0CCTL1 = OUTMOD_7;
TA0CCR1 = 30;
TA0CTL = TASSEL_2 + MC_1;
P1DIR |=(BIT1+BIT3);
while(1) {
P1OUT &=~(BIT1);
P1OUT|=(BIT3);
}
}
Then I made pin connections.
P1.2>>ENA
P1.1>>IN1
P1.3>>IN2
This code can turn motor(motor that connected to OUT1 and OUT2) as
fastly. But if I try to turn other motor with this code, motor can not
turn.
I connected to pwm output P1.2 to ENB and P1.1 to IN3 and P1.3 to IN4.
I spend many time to find my error. Why I can not turn 2 motors
simultaneously with PWM? Where is my fault? Could you help me please?
---------------------------------------
Posted through http://www.EmbeddedRelated.com
[toc] | [prev] | [next] | [standalone]
| From | Tauno Voipio <tauno.voipio@notused.fi.invalid> |
|---|---|
| Date | 2017-03-29 14:34 +0300 |
| Message-ID | <obg5vd$j83$1@dont-email.me> |
| In reply to | #26333 |
On 29.3.17 14:15, engineergc wrote:
> P1.1>>IN1
> P1.2>>IN2
> P1.3>>IN3
> P1.4>>IN4
> P1.6>>ENA&ENB(I connected pwm output to both ENA and ENB pins of L298
> motor driver card.
> Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 connectors as
> respectively.
> Then, GND of MSP430 and gnd of 9V battery are connected to GND connector
> of L298.
>
> This code can turn motor(motor that connected to OUT1 and OUT2) as
> fastly. But if I try to turn other motor with this code, motor can not
> turn.
> I connected to pwm output P1.2 to ENB and P1.1 to IN3 and P1.3 to IN4.
> I spend many time to find my error. Why I can not turn 2 motors
> simultaneously with PWM? Where is my fault? Could you help me please?
1. Are you attempting to run two motors and the processor from a single
9V battery (IEC 6F22)?
2. Have you noticed that the MSP processor has to have an output high
voltage at most L298 voltage feed - 2.5V?
--
-TV
[toc] | [prev] | [next] | [standalone]
| From | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| Date | 2017-03-29 07:00 -0500 |
| Message-ID | <i-KdnemIKcpBPEbFnZ2dnUU7-KnNnZ2d@giganews.com> |
| In reply to | #26336 |
>On 29.3.17 14:15, engineergc wrote: > >> P1.1>>IN1 >> P1.2>>IN2 >> P1.3>>IN3 >> P1.4>>IN4 >> P1.6>>ENA&ENB(I connected pwm output to both ENA and ENB pins of L298 >> motor driver card. >> Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 connectors as >> respectively. >> Then, GND of MSP430 and gnd of 9V battery are connected to GND connector >> of L298. >> >> This code can turn motor(motor that connected to OUT1 and OUT2) as >> fastly. But if I try to turn other motor with this code, motor can not >> turn. >> I connected to pwm output P1.2 to ENB and P1.1 to IN3 and P1.3 to IN4. >> I spend many time to find my error. Why I can not turn 2 motors >> simultaneously with PWM? Where is my fault? Could you help me please? > >1. Are you attempting to run two motors and the processor from a single > 9V battery (IEC 6F22)? > >2. Have you noticed that the MSP processor has to have an output high > voltage at most L298 voltage feed - 2.5V? > >-- > >-TV I am feeding msp430 from computer via USB and I fed two motors with single 9V battery from L298 +12V connector. --------------------------------------- Posted through http://www.EmbeddedRelated.com
[toc] | [prev] | [next] | [standalone]
| From | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| Date | 2017-03-29 07:04 -0500 |
| Message-ID | <DN2dnXFUrZB7P0bFnZ2dnUU7-bPNnZ2d@giganews.com> |
| In reply to | #26336 |
>On 29.3.17 14:15, engineergc wrote: > >> P1.1>>IN1 >> P1.2>>IN2 >> P1.3>>IN3 >> P1.4>>IN4 >> P1.6>>ENA&ENB(I connected pwm output to both ENA and ENB pins of L298 >> motor driver card. >> Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 connectors as >> respectively. >> Then, GND of MSP430 and gnd of 9V battery are connected to GND connector >> of L298. >> >> This code can turn motor(motor that connected to OUT1 and OUT2) as >> fastly. But if I try to turn other motor with this code, motor can not >> turn. >> I connected to pwm output P1.2 to ENB and P1.1 to IN3 and P1.3 to IN4. >> I spend many time to find my error. Why I can not turn 2 motors >> simultaneously with PWM? Where is my fault? Could you help me please? > >1. Are you attempting to run two motors and the processor from a single > 9V battery (IEC 6F22)? > >2. Have you noticed that the MSP processor has to have an output high > voltage at most L298 voltage feed - 2.5V? > >-- > >-TV I fed MSP430 from computer via USB and I fed two motors from single 9V battery. --------------------------------------- Posted through http://www.EmbeddedRelated.com
[toc] | [prev] | [next] | [standalone]
| From | Tauno Voipio <tauno.voipio@notused.fi.invalid> |
|---|---|
| Date | 2017-03-29 18:58 +0300 |
| Message-ID | <obgld5$8hq$1@dont-email.me> |
| In reply to | #26338 |
On 29.3.17 15:04, engineergc wrote: >> On 29.3.17 14:15, engineergc wrote: >> >>> P1.1>>IN1 >>> P1.2>>IN2 >>> P1.3>>IN3 >>> P1.4>>IN4 >>> P1.6>>ENA&ENB(I connected pwm output to both ENA and ENB pins of L298 >>> motor driver card. >>> Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 connectors > as >>> respectively. >>> Then, GND of MSP430 and gnd of 9V battery are connected to GND > connector >>> of L298. >>> >>> This code can turn motor(motor that connected to OUT1 and OUT2) as >>> fastly. But if I try to turn other motor with this code, motor can not >>> turn. >>> I connected to pwm output P1.2 to ENB and P1.1 to IN3 and P1.3 to IN4. >>> I spend many time to find my error. Why I can not turn 2 motors >>> simultaneously with PWM? Where is my fault? Could you help me please? >> >> 1. Are you attempting to run two motors and the processor from a single >> 9V battery (IEC 6F22)? >> >> 2. Have you noticed that the MSP processor has to have an output high >> voltage at most L298 voltage feed - 2.5V? >> > I fed MSP430 from computer via USB and I fed two motors from single 9V > battery. The IEC 6F22 battery is probably too small to run even a single motor reliably, lest two. Have you tried to run both motors together from the single battery at the same time? -- -TV
[toc] | [prev] | [next] | [standalone]
| From | Tim Wescott <tim@seemywebsite.com> |
|---|---|
| Date | 2017-03-29 11:19 -0500 |
| Message-ID | <iY2dnY8kLPTpQ0bFnZ2dnUU7-cednZ2d@giganews.com> |
| In reply to | #26339 |
On Wed, 29 Mar 2017 18:58:15 +0300, Tauno Voipio wrote: > On 29.3.17 15:04, engineergc wrote: >>> On 29.3.17 14:15, engineergc wrote: >>> >>>> P1.1>>IN1 P1.2>>IN2 P1.3>>IN3 P1.4>>IN4 P1.6>>ENA&ENB(I connected pwm >>>> output to both ENA and ENB pins of L298 motor driver card. >>>> Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 >>>> connectors >> as >>>> respectively. >>>> Then, GND of MSP430 and gnd of 9V battery are connected to GND >> connector >>>> of L298. >>>> >>>> This code can turn motor(motor that connected to OUT1 and OUT2) >>>> as >>>> fastly. But if I try to turn other motor with this code, motor can >>>> not turn. >>>> I connected to pwm output P1.2 to ENB and P1.1 to IN3 and P1.3 to >>>> IN4. >>>> I spend many time to find my error. Why I can not turn 2 motors >>>> simultaneously with PWM? Where is my fault? Could you help me please? >>> >>> 1. Are you attempting to run two motors and the processor from a >>> single >>> 9V battery (IEC 6F22)? >>> >>> 2. Have you noticed that the MSP processor has to have an output high >>> voltage at most L298 voltage feed - 2.5V? >>> >> I fed MSP430 from computer via USB and I fed two motors from single >> 9V >> battery. > > The IEC 6F22 battery is probably too small to run even a single motor > reliably, lest two. Have you tried to run both motors together from the > single battery at the same time? (Tauno means without the chip, BTW -- just running two motors in parallel straight off the battery). -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
[toc] | [prev] | [next] | [standalone]
| From | Tim Wescott <tim@seemywebsite.com> |
|---|---|
| Date | 2017-03-29 11:32 -0500 |
| Message-ID | <iY2dnY4kLPQqfEbFnZ2dnUU7-cednZ2d@giganews.com> |
| In reply to | #26333 |
On Wed, 29 Mar 2017 06:15:17 -0500, engineergc wrote: >>On Mon, 27 Mar 2017 14:39:42 +0300, Tauno Voipio wrote: >> >>> On 27.3.17 06:49, engineergc wrote: >>>> 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? >>>> >>>> >>> (Code clipped, TV) >>> >>> 1. It does not speed up a response to send the same question >>> multiple times. It may annoy potential responders. >> >>Indeed. >> >>> 2. There is no way to answer to your questions without the >>> schematic diagrams of the electronics. >> >>Or at least a pin-by-pin description of the signals you're sending out, >>including the frequency of the PWM signal. >> >>-- >>Tim Wescott Control systems, embedded software and circuit design I'm >>looking for work! See my website if you're interested >>http://www.wescottdesign.com > > Hi Tim, > > I send same question two time because edit option is not exist. In > first time I made some gramer mistakes therefore I wanted to correct > them, > since edit option is not available I added fixed form of my question as > comment. No one is going to ding you for minor spelling and grammatical errors that are obviously the result of English not being your first language. As long as your ideas are well enough organized, and we can make out what you mean, we'll be happy. > I draw pin connections by using Fritzing program. but I can not add > it > to here. How I can add my schematic to here? This is a text-only newsgroup -- allowing binaries ties up more server space, and runs the risk that it'll become a porn-only newsgroup. Generally the way to go is to post a gif or pdf of your schematic on one of the free file-hosting sites (lots of folks use imagr, I like Google Drive), then post a link in your posting. Alternately, draw schematics in text, using AACircuits or similar. This only works for little bits of schematic: it wouldn't be easy to do yours all in ASCII-art. > Since I can not add schematic I made pin connections description > below. > P1.1>>IN1 P1.2>>IN2 P1.3>>IN3 P1.4>>IN4 P1.6>>ENA&ENB(I connected pwm > output to both ENA and ENB pins of L298 motor driver card. > Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 connectors > as respectively. > Then, GND of MSP430 and gnd of 9V battery are connected to GND connector > of L298. > By using this code or another code I can not turn both motor > simultaneously.Only one motor can turn. Are you supplying 5V to the VSS pin? -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
[toc] | [prev] | [next] | [standalone]
| From | Tim Wescott <tim@seemywebsite.com> |
|---|---|
| Date | 2017-03-27 11:50 -0500 |
| Message-ID | <q7ydnQ4IucZc30TFnZ2dnUU7-fUAAAAA@giganews.com> |
| In reply to | #26298 |
On Sun, 26 Mar 2017 22:49:54 -0500, engineergc wrote:
> 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 <msp430.h>
>
> 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 http://www.EmbeddedRelated.com
IIRC the L298 is a fairly slow device -- how fast is your PWM?
--
Tim Wescott
Control systems, embedded software and circuit design
I'm looking for work! See my website if you're interested
http://www.wescottdesign.com
[toc] | [prev] | [next] | [standalone]
| From | Tauno Voipio <tauno.voipio@notused.fi.invalid> |
|---|---|
| Date | 2017-03-27 21:12 +0300 |
| Message-ID | <obbkhl$dm9$1@dont-email.me> |
| In reply to | #26298 |
On 27.3.17 06:49, engineergc wrote: > 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? Have you read the datasheet and application notes at <http://www.st.com/en/motor-drivers/l298.html>? -- -TV
[toc] | [prev] | [next] | [standalone]
| From | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| Date | 2017-03-29 05:52 -0500 |
| Message-ID | <Qt-dnUEvGadHDEbFnZ2dnUU7-IXNnZ2d@giganews.com> |
| In reply to | #26315 |
>On 27.3.17 06:49, engineergc wrote: >> 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? > > >Have you read the datasheet and application notes at ><http://www.st.com/en/motor-drivers/l298.html>? > >-- > >-TV I read datasheet many times. But I can not find problem. --------------------------------------- Posted through http://www.EmbeddedRelated.com
[toc] | [prev] | [next] | [standalone]
| From | "engineergc" <116985@EmbeddedRelated> |
|---|---|
| Date | 2017-03-29 06:22 -0500 |
| Message-ID | <99CdnT0gG7xFBUbFnZ2dnUU7-dnNnZ2d@giganews.com> |
| In reply to | #26332 |
>>On 27.3.17 06:49, engineergc wrote:
>>> 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?
>>
>>
>>Have you read the datasheet and application notes at
>><http://www.st.com/en/motor-drivers/l298.html>?
>>
>>--
>>
>>-TV
>
>
>
>
>---------------------------------------
>Posted through http://www.EmbeddedRelated.com
Hi;
I send same question two time because edit option is not exist. In
first time I made some gramer mistakes therefore I wanted to correct them,
since edit option is not available I added fixed form of my question as
comment.
I draw pin connections by using Fritzing program. but I can not add it
to here. How I can add my schematic to here?
Since I can not add schematic I made pin connections description
below.
P1.1>>IN1
P1.2>>IN2
P1.3>>IN3
P1.4>>IN4
P1.6>>ENA&ENB(I connected pwm output to both ENA and ENB pins of L298
motor driver card.
Also Motor outputs are connected to OUT1,OUT2,OUT3 and OUT4 connectors as
respectively.
Then, GND of MSP430 and gnd of 9V battery are connected to GND connector
of L298.
By using this code or another code I can not turn both motor
simultaneously.Only one motor can turn.
***SECOND CODE***
Also I tried many another codes. I added one of them to below. In this
code I adjusted frequency of motor as 20 khz. If frequency is equal to 20
khz, period of motor is equal to T=1/f=1/20000 50us. I used clock source
as SMCLK. SMCLK is supplied from DC0 and DCO is adjusted to 1MHZ.
Therefore I write TA0CCRO=50 and I adjusted TA0CCR1=30.
#include <msp430.h>
int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
DCOCTL=CALDCO_1MHZ;
BCSCTL1=CALBC1_1MHZ;
P1DIR |=BIT2; //PWM output
P1SEL |=BIT2;
TA0CCR0 = 50;
TA0CCTL1 = OUTMOD_7;
TA0CCR1 = 30;
TA0CTL = TASSEL_2 + MC_1;
P1DIR |=(BIT1+BIT3);
while(1) {
P1OUT &=~(BIT1);
P1OUT|=(BIT3);
}
}
Then I made pin connections.
P1.2>>ENA
P1.1>>IN1
P1.3>>IN2
This code can turn motor(motor that connected to OUT1 and OUT2) as
fastly. But if I try to turn other motor with this code, motor can not
turn.
I connected to pwm output P1.2 to ENB and P1.1 to IN3 and P1.3 to IN4.
I spend many time to find my error. Why I can not turn 2 motors
simultaneously with PWM? Where is my fault? Could you help me please?
---------------------------------------
Posted through http://www.EmbeddedRelated.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.arch.embedded
csiph-web