HPWM10 Frequency Updating


Results 1 to 18 of 18

Threaded View

  1. #1
    Join Date
    Oct 2004
    Location
    North Norfolk UK
    Posts
    146

    Default HPWM10 Frequency Updating

    Hi

    This week I are been mostly working on HWPM.......... to produce undetermined fixed frequencies on CCP1 between approx 10,000Hz and 500,000Hz for durations of approx 10 seconds. For the moment the dutycycle is a secondary consideration. I am testing using a 16f628A at the moment but I may have to change to an 18 series. It must use HPWM

    As this is a broad range and to achieve better resolution at the higher frequencies I am running at 16mhz and introducing prescaling at the lower frequencies.

    The frequency required is received HSER as a WORD and the code calculates PR2 etc. My own code sort of works Ok but it is very ugly and limited ( I upgraded to 2.5 to use LONGS etc but have yet to been unable to get PBL to compile with anything significant )


    However,

    I have also had an constant eye on HPWM10 By Darrell Taylor (Peu and Mister E whose Pic multi-Calc I use as de facto: thankyou Mister E) considering that I may have certain frequency ranges dedicated to different channels.

    HPWM10 works beautifully to update the dutycycle of given frequencies, smooth and glitch free and very easy to use. However I would be using it the other way round ie to update the frequency for a given dutycycle. Given the fact that 10Bit resolution is not always available over the ranges I am working with, I set the variable _DutyCycle = 100.

    There are stages in my frequency range when the BYTE value of PR2 overflows and the prescaler is incremented. For the purpose of this post I have the prescaler set 1:1

    A bit long winded but I have captured the value of PR2 with respect to frequency as output from HPWM10 and inconsistencies start to occur around 35940Hz , PR2 recovers at 36140Hz but as can be seen in capture1.txt the trend occurs more regularly thereafter. The inconsistencies are as compared to Mister E's Pic multi-Calc.

    I should be able to work out why this is happening rather than just observing, however I am confused......... could this be to do with parsing during the maths calculation?

    Duncan
    Attached Files Attached Files

Similar Threads

  1. Advice on frequency measurement to 30MHz
    By Andy Wood in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th March 2009, 04:23
  2. HPWM command and oscillator frequency
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th March 2009, 22:41
  3. inaccurate frequency using TMR1 PI18F452
    By nkarpovich in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 14th October 2006, 16:22
  4. frequency measurement
    By big-x in forum General
    Replies: 2
    Last Post: - 25th November 2005, 00:53
  5. Low frequency output
    By barkerben in forum General
    Replies: 5
    Last Post: - 16th November 2004, 15:25

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