HPWM confusion


Closed Thread
Results 1 to 13 of 13

Thread: HPWM confusion

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    So grossely, I am doing a line following robot, if I use PWM, then the sensors are not working. Also, I only have two channel to use PWM, so only two motors can use HPWM on one chip. right?

    k

  2. #2
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    Thats wright.
    A 16F87(3)6 should do it. It has 2 Hpwm outputs.

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    HI,

    I am using an H-bridge L293. It seems that there are thre wires per motor for control. 1 for neg. , 1 for pos. and one for the HPWM. The PWM is put on the CCP1, while the other do not matter, as long as they are configured as 1 or 0 right ? well thats what I concluded from what I read. Is there any reason why this code would not work ? I am not getting any output

    if right > left Then
    temp =right-left
    temp= temp * 254
    temp= temp/right
    PORTC.4=0
    PORTC.5=1
    HPWM 1,255-temp,1000
    HPWM 2,255,1000

    Else
    temp =left-right
    temp= temp * 254
    temp= temp/left
    PORTC.4=1
    PORTC.5=0
    HPWM 2,255-temp,1000
    HPWM 1,255,1000
    Endif

  4. #4
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    To be more precise, the circuit seems to wok without the motor connected. when i conencted the motor, then the LCD screens shows very low numbers, and the motor might turn just for 1-2 seconds, otherwise it makes a noise, I guess thats my 2000hz
    Just one time the motor turned on and changes direction 3 times very quickly.

    Should my power supply for the L293 be different then for the pic ?

    k

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    last code still not working
    Again i hear a buzz, and sometime the motor turns a little.
    Also on the oscilloscope, sometime he output is sitting at zero, or when its oscillating, it looks like its going from -4 to 1volt

    if right > left Then
    temp =right-left
    temp= temp * 254
    temp= temp/right
    PORTC.4=0
    PORTC.5=1
    HPWM 1,255-temp,2000
    HPWM 2,255,2000
    Endif

    if left >= right then
    temp =left-right
    temp= temp * 254
    temp= temp/left
    PORTC.6=0
    PORTC.7=1
    HPWM 2,255-temp,2000
    HPWM 1,255,2000
    Endif

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    lerameur,

    Why don't you create an excel sheet and see all numbers?

    Have all possible right and left values in a row, and do the formula, put the result in another row.

    Then you can see how the numbers behave, from a possible minimum value to a possible maximum value.


    -------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Default

    Should my power supply for the L293 be different then for the pic ?
    It's usualy a good pratice to split your PSU lines. You could use one regulator/line.

    Also, when dealing with POWER, you should split your GND lines (analog, Digital, PowerDevices) then tie them at them at a single point.

    It's also good practice to isolate POWER from Logic. OPTO couplers come handy in those case.

    Be sure ALL psu line are well filtered and noise free.

    Another things... be sure you Motor don't need much current than regulator can give.

    last code still not working
    Again i hear a buzz, and sometime the motor turns a little.
    Also on the oscilloscope, sometime he output is sitting at zero, or when its oscillating, it looks like its going from -4 to 1volt
    O.K, could you provide more details, wich motor model you use and post your schematic here.

    Personnally i hate guessing. I'm sure we could find the solution faster if you posted the whole thing on your first post.

    Please for the next(s) time(s) give us all you have. A schematic is often a MUST. If you have a board layout too.
    Steve

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

Similar Threads

  1. HPWM Confusion in spec sheet
    By lerameur in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th September 2008, 00:48
  2. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  3. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  4. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43
  5. HPWM confusion
    By rossfree in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd November 2005, 16:50

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