still don't have solution!!!


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rmteo View Post
    With a 8Mhz clock, you can get up to 500MHz PWM, albeit with little to no resolution on the duty cycle.
    post #8

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    OK, here is a brain teaser for you. With an 8MHz clock on a PIC16/18, what is the maximum frequency HPWM that can be achieved, and how would you do it (in terms of register values for CCPR1L and PR2)?
    Hint: the answer is in the scope trace above.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rmteo View Post
    OK, here is a brain teaser for you. With an 8MHz clock on a PIC16/18, what is the maximum frequency HPWM that can be achieved, and how would you do it (in terms of register values for CCPR1L and PR2)?
    Hint: the answer is in the scope trace above.
    Can't see the 'scope trace here (server won't let the image thru)...
    In the absense of any other information (PIC type, CCP or ECCP, not that it matters), I would guess 1Mhz...
    8Mhz / 4 ( crystal vs. Fosc) = 2 Mhz, but still need another cycle to set and/or reset the outputs in the CCP module, hence 1Mhz. Again, don't have enough info, nor datasheets handy.

  4. #4
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Ski, you hit the nail on the head, 1MHz it is. I tested it in hardware and looked at the scope. It would apply to any PIC12/16/18 with either CCP or ECCP at 8MHz clock. You could get 2MHz (fFOsc) out of CLKO though.

    BTW, the settings would be:
    PR2 = 1
    CCPR1L = 1

  5. #5
    Join Date
    Aug 2008
    Posts
    45


    Did you find this post helpful? Yes | No

    Default

    thanx everyone.i can get 332khz with 50% duty cycle using OSC 20MHz...

  6. #6
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Can't see the 'scope trace here (server won't let the image thru)...
    In the absense of any other information (PIC type, CCP or ECCP, not that it matters), I would guess 1Mhz...
    8Mhz / 4 ( crystal vs. Fosc) = 2 Mhz, but still need another cycle to set and/or reset the outputs in the CCP module, hence 1Mhz. Again, don't have enough info, nor datasheets handy.
    Amazing as it seems, you can generate a 2MHz PWM with an 8MHz clock. Not only that but you also get 2-bit resolution (4 duty cycles).

  7. #7
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rmteo View Post
    Amazing as it seems, you can generate a 2MHz PWM with an 8MHz clock. Not only that but you also get 2-bit resolution (4 duty cycles).
    Using the 4xPLL is cheating!

  8. #8
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    No PLL used, just 8MHz clock.

  9. #9
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rmteo View Post
    No PLL used, just 8MHz clock.
    k, I give. how you plan on doing that?
    0%, 100%, spikey 1% and spikey 99%?

  10. #10
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    post #8
    mea culpa. Should have been 500KHz.

Similar Threads

  1. Strange I2C problem (and solution)
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th December 2008, 19:14
  2. Replies: 6
    Last Post: - 20th September 2008, 12:28
  3. The Best Solution
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 28th May 2007, 05:25
  4. Need PC software solution
    By mister_e in forum Off Topic
    Replies: 9
    Last Post: - 27th November 2005, 02:18
  5. Battery Solution
    By Keith in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd July 2005, 06:07

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