PWM PIN(S), DUTY, CYCLE ?Plural possible?


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96

    Red face PWM PIN(S), DUTY, CYCLE ?Plural possible?

    I am sure this is a dumb question....but I will suck up my pride and ask it anyway..
    Is it possible to use the PWM command on multiple pins?

    ex:

    pwm portb.0 & portb.1, 127, 3000

    this does compile but only performs PWM on portb.1

    I need to drive 2 seperate h-bridges at the same time and for the same # of cycles...

    any help would be great.
    Padawan-78

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    This is probably a silly question, but if you are attempting to drive two pins with the same signal, at the same time and the same phase, why do you need TWO pins?
    Charles Linquist

  3. #3
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96


    Did you find this post helpful? Yes | No

    Default 2 pins

    As I stated, I am driving 2 seperate h-bridges...each bridge has 2 inputs. I have a total of 4 inputs to both h-bridges and want to always drive 2 pins at any one time.
    if I want my robot to turn right I need to drive

    'ex: not actual code...

    rightwheelfw var portb.0
    rightwheelrs var portb.1
    leftwheelfw var portb.2
    leftwheelrs var portb.3

    turnright:
    high rightwheelrs
    high leftwheelfw
    pause 50
    goto commands

    turnleft:
    high rightwheelfw
    high leftwheelrs
    pause 50
    goto commands


    In my case though I want to have variable speed control not just HIGH.
    This is why I want PWM on 2 pins at the same time.
    Padawan-78

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    there's some PIC which give you 2 different CCP module and allow that.

    There's also some PIC with ECCP (even a 12F615), which can be used to drive in half bridge/Full bridge mode + few feature such as dead band time. 18F2431/4431 are some good example.
    http://ww1.microchip.com/downloads/e...Doc/39616C.pdf

    depending your expected PWM frequency, Darrel's Muti_SPWM could be used
    http://www.pbpgroup.com/modules/wfse...p?articleid=12

    Timer interrupt is another way to go.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  2. Replies: 9
    Last Post: - 8th October 2008, 11:15
  3. HPWM the old fashioned way
    By Srigopal007 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 19th November 2004, 19:09
  4. PWM _ Duty Cycle in Tenths
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 17th May 2004, 12:09
  5. Duty Cycle Dilemmas
    By crankshaft in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th February 2003, 12:40

Members who have read this thread : 0

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