manual hardware PWM setup on 16F1824


Closed Thread
Results 1 to 24 of 24

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    rmteo,
    No, post 11 doesn't answer the question... it again does not tell me why...

    If i wanted 1 MHz pwm frequency and the pwm hardware is 10 bit then i'd have to give the PWM 'chip' a 1024MHz clock frequency...

    If i give the PWM 'chip' a 1MHz clock and the resolution is 10bit then i would expect the pwm frequency to be (1,000,000/1024) = 976.5625Hz

    Changing the bits based on clock input frequency (i believe your saying) is stupid...
    Thats like building a car that will only turn left when the engine RPM is above 6,000 RPM...

    If this 'variable' bit resolution is because the PWM hardware in the micro-controller can't keep up above certain speeds then it should be specified as rated upto a certain frequency...
    This is how all but one PWM chips that I've previously programmed have worked... the one exception was a royal pain in the ass!

    As it is, the frequency that i want is supported at 10 bits (apparently)... while my duty is 8 bit, it's just a few cpu cycles to times it by 4 and then do the PWM 'update'...

    scalerobotics

    I found this helpful, maybe you will as well. It is mostly about the hardware, so it is a good example to understand it better. It was done by a company that makes a C compiler.

    http://www.mikroe.com/eng/chapters/v...ntroller/#c3v7
    oky, so two lots of PR registers... one for 'pules duration' aka duty... the other for 'pulse period' apparently thats frequency... the PWM output frequency should be defined by the input clock divided by the resolution...

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by comwarrior View Post
    Changing the bits based on clock input frequency (i believe your saying) is stupid...
    Thats like building a car that will only turn left when the engine RPM is above 6,000 RPM...
    Why are you so worried about the resolution it is going to have at that high frequency? What is your application? I thought you didn't need more than 8 bit resolution anyway!!!

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    No where is it stated that the PWM hardware is 10-bit (it doesn't make sense anyway). The duty cycle is set by loading a 10-bit register (comprising CCPxCON5:4 and CCPRxL).
    Why pay for overpriced toys when you can have
    professional grade tools for FREE!!!

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