frequency counter help and pointers


Closed Thread
Results 1 to 3 of 3
  1. #1

    Default frequency counter help and pointers

    hi everyone...
    I want to add a frequency output onto my telemetry output...

    What i don't want is to use interupts because the program also controlls the speed, so an interupt in the middle of a speed correction would be bad...

    what i'm thinking of is a var to count the power pulses say upto 10 and then read the the elapsed time and work out the frequency in Hz...

    I believe i should be using tmr1 but have found little info on not using interupts...

    Can someone please point me in the right direction... perhaps give me the commands to lookup... etc etc

    Thanks

  2. #2
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default Timer1

    Usually at leat one ore more timers have a hardware external clock input TMR1CKI (timer 1 clock input) and that one you can use for counting pulses. Or you can use the CCP (capture and compare) hardware and catch a number of pulses.

    Both ways can be used with or without interupts.

    Or you can use the count function in PBP but if you use DT intant interupts and a HW solution I can really not see how that can be a major problem for other things.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thanks jumper...

    i had another look at the datasheet this morning (i see clearly now that the matrix code has stopped falling infront of my eyes)...
    Timer1, has two clock sources, External via RC0/T1CKI or internal (Fosc/4)

    Am i right in thinking Fosc/4 is the 'master' clock devided by 4? so, i'm using a 20MHz master clock, to the frequency for TMR1 will be 5MHz?

    Again, please correct me if i'm wrong...
    The prescaler for TMR1 if i set it to 1:8 does that mean the the clock frequency is devided by 8 resulting in a clock frequency of 625KHz?

    I think the datasheet is actually starting to settle into my brain...

    so, it's a 16bit timer, so it'll count upto 65535 pulses or for 0.104856 seconds...

    So, if we assume a minimum of 4 power pulses to count (= 1 shaft rotation) therefor the minimum readable speed will be 600 RPM but after that, it should be accurite...

    Am i about right?

    thanks
    Last edited by comwarrior; - 30th June 2009 at 11:55.

Members who have read this thread : 1

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