What is the best way to make forward reverse


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2005
    Posts
    19

    Default What is the best way to make forward reverse

    Hi,

    I'm currently developing a robot powered by two motors. I connect the motors to a driver to pin c1 and c2 (for forward) and c3 and c4 (for reverse) of PIC 16F877A. I try move left and right. When I move left, I need to make left move reverse and right motor forward. How I can do that using HPWM or PWM? I found that HPWM only support forward because it only has 2 channel.

    <code>
    hpwm 1, 100, 1000
    hpwm 2, 100, 1000
    </code>

    When I try using PWM, only the last line is executed.
    <code>
    pwm portc.1, 100, 100 'forward right
    pwm portc.4, 100, 100 'reverse left
    </code>

    why only last line is executed?
    What is the best way to make forward reverse using hpwm or pwm. TQ

  2. #2


    Did you find this post helpful? Yes | No

    Default reverse direction

    In most cases, you use the PWM only to supply the speed of the motor, not the direction. If you use something like a L298 dual H-bridge to drive your motors and look after polarity reversal, you're all set.

    ------------Picster------------

  3. #3
    Join Date
    Nov 2005
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    Actually I already used that driver. I told in the first post of this thread that I connect to the motors through a driver to the PIC port c1, c2, c3 and c4. I just need to progam forward reverse using hpwm or pwm.
    Last edited by guanerrr; - 11th April 2006 at 05:27.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Wink think simple ...

    Hi, guanerr ...

    Just have a look to new PICs with the Enhanceded PWM module ...

    they can drive by soft all types of output bridges !!! reverse is also here !!!

    see 16F 684 i.e.

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Nov 2005
    Posts
    19


    Did you find this post helpful? Yes | No

    Default

    But I already installed with 16F877A. I don't wanna waste my time and money. I think there must be a solution.

Similar Threads

  1. Change On Interrupt, PIC16F884
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 14th November 2008, 18:25
  2. PBP is driving me crazy trying to make an 18F chip blink
    By George in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th June 2008, 07:08
  3. NEWB Help HPWM coding
    By Seafurymike in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st January 2008, 22:52
  4. How come they make electronics hard as poss
    By George in forum Off Topic
    Replies: 9
    Last Post: - 14th July 2007, 00:54
  5. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 04:46

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts