![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Guest
|
Changing the direction of a motor |
Posted: Fri Nov 13, 2009 4:25 pm |
|
|
I know most PIC's cannot output enough current to drive a DC motor, but let's say they could. Is it possible in CCS to change the polarity of a motor that's connected +- to two in/out pins? For instance, for fwd, the code would be:
Code: |
//FORWARD
output_low (pin_1); ground the motors - pin
output_high (pin_2); 5V to the motors + pin
//REVERSE
output_high (pin_1); 5V to the motors - pin
output_low (pin_2); ground the motors + pin
|
My project requires 2 servos, but I have to custom make them and I'm not sure what components will allow me to change the polarity of the motor. Each servo will be analog, relying on the output of a connected potentiometer. If this isn't possible to achieve with a PIC, does anyone know where I can order JUST the chip that's in a typical servo?
The circuit needs to be as lightweight as possible because it's going to be mounted on a hand thrown glider, which is why I have to custom-make it. It also needs to be inexpensive. Can anyone suggest another method of changing the polarity of a DC motor? Each servo/motor will control an aileron on the glider.
Thanks in advance! |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Fri Nov 13, 2009 5:18 pm |
|
|
Hi,
Sure, that will work, but as you note, the current will be quite limited. I use basically the same method to control a bi-color LED (red/green) for a status indicator on my projects.
Doug |
|
![](templates/subSilver/images/spacer.gif) |
languer
Joined: 09 Jan 2004 Posts: 144 Location: USA
|
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Tue Nov 17, 2009 1:02 pm |
|
|
Hey thanks for the ideas! I found a DUAL DC motor control chip with built in bridge and all, which will work perfectly, for under a dollar. If anyone's interested, making a servo this way makes for much more fluid movement. Instead of the ugly sound of a pulsing motor, everything works in single perfect and accurate movements. Technically it's not even a servo, but is just as accurate. |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Tue Nov 17, 2009 3:30 pm |
|
|
And what is the name of the chip? |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Tue Nov 17, 2009 3:40 pm |
|
|
The chip model number is A3901, it's a DUAL digital DC motor control chip which uses 2 interrupts per motor to determine the activity and direction of the connected motor. The only tough part is creating the mechanics, gears, and connecting it all to a pot.
http://www.allegromicro.com/en/Products/Part_Numbers/3901/3901.pdf |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|