View previous topic :: View next topic |
Author |
Message |
evaradharaj
Joined: 15 Jan 2009 Posts: 60
|
Re:DC motor control |
Posted: Sun Nov 28, 2010 9:00 am |
|
|
Hi,
I am usng PIC16f877a. I am controlling 2 DC motors (12V, .5A each) with that microcontroller. I am using l293d IC for rotating the motors in forward and reverse direction.
I have checked the motors with l293d without 16f877a. The motors are rotating properly. But if I connect with microcontroller, the output pin's logic levels are 1.2V only.
For high logic and low logic also in 1.2 V only. Why the voltage is dropping to 1.2V? I am using portB for outputs.
I will give the code,
Code: |
portB_pullup(TRUE);
set_tris_b(0x00);
while(1)
{
output_B(0xA0); // forward direction
delay_ms(5000);
output_B(0x50); // reverse direction
delay_ms(5000);
}
|
Thanks in advance,
Regards,
Varadharaj E _________________ embedding innovation in engineers |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9225 Location: Greensville,Ontario
|
|
Posted: Sun Nov 28, 2010 9:47 am |
|
|
PortB pins 7 and 6 are also used for programming the chip(PGC,PGD).
If you're using them to program the PIC, there is a potential conflict with your hardware.
Also you do not need to use these lines of code
portB_pullup(TRUE); only needed if used for Inputs..
set_tris_b(0x00); be very careful using TRIS functions
Not needed, let the compiler handle it for you automatically!
Try your revised program without the L293d chip and see what the levels are.
Also be sure to use filtering caps across the motor's leads to reduce noise feeding back to the PIC.Is the power supply good for at least 3 Amps ? The PIC power pins need to be stable. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sun Nov 28, 2010 1:05 pm |
|
|
What is Vcc1 on the L293 connected to?.
Have you got the flyback diodes on the motors?.
The only thing in the L293, that would cause ths behaviour, would be Vcc1, not siting at the PIC supply voltage.
Best Wishes |
|
|
evaradharaj
Joined: 15 Jan 2009 Posts: 60
|
Dc motor control |
Posted: Sun Nov 28, 2010 11:46 pm |
|
|
Hi,
First, thanks for your replies.
I didn't connect the flyback diodes externally. If I take the outputs from PIC separately (without connecting to the l293d ic), it is giving proper logic levels.
And it is following the program. But if I connect with L293d ic only (without connecting motors in l293d), all logic levels are 1.2V.
The Vs(supply voltage) ---- > +12V
Vss ---> +5 V
En1 and En2 ---> Vss.
Thanks in advance,
Regards,
Varadharaj E _________________ embedding innovation in engineers
Last edited by evaradharaj on Mon Nov 29, 2010 10:52 pm; edited 1 time in total |
|
|
evaradharaj
Joined: 15 Jan 2009 Posts: 60
|
Re: external pullups for portb pins |
Posted: Mon Nov 29, 2010 9:41 pm |
|
|
Hi,
Shall I use external pull-ups for logic output pins (port b) to drive l293d ?
please reply me if you have found any solutions..
Regards,
Varadharaj E _________________ embedding innovation in engineers |
|
|
|