freq counter 0-70hz pic16f877


Closed Thread
Results 1 to 10 of 10
  1. #1
    picpower's Avatar
    picpower Guest

    Default freq counter 0-70hz pic16f877

    hi

    can anyone please help me, i'am making a speedometer for my electric bycycle, and need to messure pulses between 0-70hz and do some math to get the Km/h

    i,am using pic16f877 with 16Mhz and pic basic pro.

    maybe with interrupt, because i have to messure amps and volts at the same time, and at a low freq, the loop will take to long.


    sorry for my bad english :-)

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink Simple way

    Hi,PicPower

    Why not use a simple F/V like LM 2907 or LM 331 and one of the PIC A/D's.

    Moreover it will be easy to calibrate the speedo with a simple external pot !!!

    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 " !!!
    *****************************************

  3. #3
    picpower's Avatar
    picpower Guest


    Did you find this post helpful? Yes | No

    Default

    hi

    i dont want to make a digital signal to analog and then digital again.

    and i have maked the pcb so it has to be done with the pic

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


    Did you find this post helpful? Yes | No

    Wink Too late

    Hi, PicPw

    so, The question is to know what else do yo do w/the PIC ...

    If just Speed I and U and display implemented, a PicBasic interrupt ( RTFM : simple to do ... ) will be OK.

    The question is also wich is your refresh rate ??? one I and U measure per second could be enough to be readable.

    We do not know enough about your project to give valuable solutions ...

    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
    picpower's Avatar
    picpower Guest


    Did you find this post helpful? Yes | No

    Default

    i only have to messure I and U and the speed.

    it is possible to start timer0 when i receive a high pulse and stop the counter when the next high pulse is coming?

    and can the pic do other things when the timer0 counts?

  6. #6
    Join Date
    Oct 2005
    Location
    Pinckney, Michigan
    Posts
    91


    Did you find this post helpful? Yes | No

    Default

    You can implement your speedometer easily with the PULSIN command.

    You don't have to wait for a full revolution of you wheel.

    Just install either magnets or reflective tape at equidistant intervals around your wheel and measure the time between any two magnets (or tape), keeping in mind that this measurement is only a fraction of a wheel revolution (and a fraction of a second). Handle the extrapolation in integer math.

    I'm doing something similar with rotor tachometers and many other things on a helicopter. The software is written in a loop structure, such that all the measurements are taken and processed many times a second.

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by picpower
    i only have to messure I and U and the speed.

    it is possible to start timer0 when i receive a high pulse and stop the counter when the next high pulse is coming?

    and can the pic do other things when the timer0 counts?
    Hi,PicPw

    You can use the CCP in capture Mode ...

    You could also use Timer 1 as a free running timer and read it periodically ...see Microchip datasheet Timer section for details.

    There are many many ways to do it ...

    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 " !!!
    *****************************************

  8. #8
    Join Date
    Mar 2004
    Posts
    74


    Did you find this post helpful? Yes | No

    Default

    I too would like to get some pointers for a similar project. I want to decode CTCSS tones using a pic. These are pre defined tones lying between 50 and 300Hz. How would I go about having a lookup table of tones and comparing the incomming tone with one in the lookup table? this would have to be done very quickly, 100ms or better

  9. #9
    Join Date
    Aug 2005
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    Attached is a program for counting pulses using Tmr1 set in the counter mode and Tmr0 set as an interrupt timer.The interrupt timer counts ticks,after 1 second Tmr1's accumulated count is serial outputed.
    Attached Files Attached Files

  10. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink one step further ...

    good !!!

    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 " !!!
    *****************************************

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. i2c data com. to 24lc512 in freq counter
    By tamertokgoz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st June 2008, 19:48
  3. Replies: 14
    Last Post: - 26th September 2007, 05:41
  4. How to set TMRO & TMR3 as Counter?.
    By NatureTech in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 18th May 2007, 08:52
  5. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27

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