CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Re:DC motor control

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
evaradharaj



Joined: 15 Jan 2009
Posts: 60

View user's profile Send private message Visit poster's website

Re:DC motor control
PostPosted: Sun Nov 28, 2010 9:00 am     Reply with quote

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: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 9:47 am     Reply with quote

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: 19510

View user's profile Send private message

PostPosted: Sun Nov 28, 2010 1:05 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

Dc motor control
PostPosted: Sun Nov 28, 2010 11:46 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

Re: external pullups for portb pins
PostPosted: Mon Nov 29, 2010 9:41 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group