HPWM confusion


Closed Thread
Results 1 to 13 of 13

Thread: HPWM confusion

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    >> But I was wandering what the command ccp1 does in the Pic16f876a chip does.

    CCP1 is NOT a command, but a REGISTER within your PIC.

    To discover what it does, download and read the Datasheet for your PIC16F876A. A really good place to start is section 8 - Capture/Compare/PWM Modules.

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


    Did you find this post helpful? Yes | No

    Default

    Welcome back Melanie!



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

  3. #3
    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

  4. #4
    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.

  5. #5
    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

  6. #6
    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

  7. #7
    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

Similar Threads

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