Accurate Freq Measurment


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default timer 5

    Bruce & Terry,
    I have been following posts on freq measure. That timer 5 with the motion feedback module is just super-neat. Hardly any code to get very accurate measure. Being able to measure small ,small errors is amazing.
    Terry, if you don't mind, how much are your readings varying around the 4khz and what clock did you end up using?
    Also, what are you doing with the output value?
    Hats off to you guys.
    don
    amgen

  2. #2
    Join Date
    Dec 2005
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Don,
    I have been experimenting with both the prescaler (divide by 16) and skipping it. When I use an Agilent frequency generator for testing, the count only jitters by 1 count with either approach, the measurement is very stable under this test situation with both approaches. Now that I have the PIC code working, I am now experimenting with my actual application to see which is the better method.
    When measuring the period of 200 cycles of a 4 kHz signal, the frequency resolution is great, 1 count corresponds to 0.016 Hz at 4 KHz and the measurement time is 50 msec. The PIC counters are great once you understand how to set them up.
    I output the count data via RS-232 to a PC.
    Terry

  3. #3
    Join Date
    May 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Accurate Freq Measurment

    Hi,

    I've read the great advice and example code here during a search of PIC period measurement. I'm in the process of using a PIC 18F2431 and using C.

    Not being an expert with PICBasic, could I ask what PIR3.1 refers too from the example given above?

    Code:
    Capture VAR PIR3.1
    Thanks in advance, David.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Accurate Freq Measurment

    Hi,

    "C" ... What is "C" ...

    is there anything called "C" somewhere ????

    has "C" ever existed ???

    Just open your pic datasheet, interrupts flags section ... you'll find it.

    BTW : VAR ... just means " other name for " ( something like # DEFINE ... Ooops ... )

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: Accurate Freq Measurment

    PIR3.1 is bit #1 in the PIR3 register. Capture VAR PIR3.1 just creates an alias for this interrupt flag bit.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    May 2011
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: Accurate Freq Measurment

    Quote Originally Posted by Bruce View Post
    PIR3.1 is bit #1 in the PIR3 register. Capture VAR PIR3.1 just creates an alias for this interrupt flag bit.
    Many thanks Bruce that makes it perfectly clear.

    @Alain Thanks too. Apologies for mentioning the "C" letter BTW!

    As for the RTFM thing. Please, it's a cop out. It's the easiest thing in the world to belittle someone for not finding the information (or quite understanding how to frame a question) you may think should be obvious, but in the context of the wider picture may not be to the person asking the question. And of course the "Problem" may only be one of several or several tens that the poster may be concurrently dealing with at the time of the question.

    Sorry Alain, I really don't mean to appear to be negative after you've been kind enough to reply to my question, it's just that RTFM is so often used to limit learning, not encourage it.

    So yes, I see now that Section 10.2 (Page 102) "PIR Registers" of the data sheet provides the information for the code I was referring to. That's one problem down...many more to go.

    Thanks again for your inputs. David.

Similar Threads

  1. Easy and Accurate Clocks without RTC IC
    By paul borgmeier in forum Code Examples
    Replies: 18
    Last Post: - 28th October 2013, 22:28
  2. reducing shiftout clock freq and PS2/PC interfacing ....
    By wireless magic in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 26th February 2008, 21:15
  3. accurate vref < 1vdc 16F876 comparator
    By mslaney in forum Schematics
    Replies: 1
    Last Post: - 23rd March 2005, 02:44
  4. HPWM on a 628 is not changing freq.
    By dtit in forum General
    Replies: 2
    Last Post: - 25th February 2005, 10:34
  5. More accurate resolution from the A/d converters
    By pjsmith in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 5th August 2004, 23:49

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