Updating HPWM frequently, safe?


Closed Thread
Results 1 to 40 of 79

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    With 16F876's, both CCP modules use the same Timer in PWM mode (TMR2).
    If you change the frequency of one, the other one changes too.

    With a 4 Mhz crystal, the minimum HPWM frequency is 245 Hz.
    Since you are using a 1 Mhz crystal, you can get down to 62 Hz, but you have to specify the frequency as if it were running at 4 Mhz.

    If you want 100 Hz, then specify 400 Hz in the HPWM10 command.
    93 is way below the minimum.
    <br>
    DT

  2. #2
    Join Date
    Jan 2006
    Location
    Slovenia EU
    Posts
    32


    Did you find this post helpful? Yes | No

    Default

    Frequency of 100 Hz is not a problem. In the case that I use PIC16F886 asking whether the command HPWM10 set timer TMR1 and TMR2 for each channel?
    Can you write the registry settings for the PIC16F886?

    tnx
    Samo

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Even on a PIC16F887, the CCP modules can only use Timer2 in PWM mode.
    So both PWM channels will operate at the same frequency.

    So I guess the answer to your question is ...
    HPWM10 only changes Timer2, not Timer1.
    <br>
    DT

  4. #4
    Join Date
    Aug 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Darrel,

    Whats required to have 'glitch free' operation but with 8 bit PWM, can the include file be easily modified for 8 bit, or should i just multiply my desired 8 bit dutycycle by 4?

  5. #5
    Join Date
    Aug 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    Also, just testing on 16F887, at 4mhz,

    @ HPWM10 1,_OUTDUTY,300 results in a PWM frequency of 10khz according to my o'scope ???
    I see the duty cycle changing, but the freq is around 9-10khz?

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    The frequency must be a variable.
    You can't pass a constant as the parameter.

    And just shift left 2 (<<2) to use 8-bit values.

    hth,
    DT

  7. #7
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Angry Re: Updating HPWM frequently, safe?

    Old thread but very relevant to my issue.

    Can I use HPWM10:

    1. On an 18F87J50?
    2. And have it glitch free?
    3. To make a pulse train that's 140mS long and have varying duty cycles within the pulse train?

    In other words: 300uS on, 200uS off, 300uS on on, 200uS off, 130uS on, 370 uS off, 300uS on, 200uS off, 130uS on, 370uS off, 170uS on, 330uS off, 130uS on, 370uS off, etc.

    Each bit is 500uS and I don't need to modify anything while the packet is being sent; I can modify right before the next one is sent.
    Last edited by Christopher4187; - 16th June 2015 at 15:50.

Similar Threads

  1. need help on hpwm
    By helmut in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 28th August 2007, 16:49
  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. HPWM and A to D interaction question 18F252
    By tcbcats in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 10th May 2006, 04:50
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 03:43

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