Hardware capture on 16F876


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2006
    Location
    ist
    Posts
    13

    Default Hardware capture on 16F876

    hi people ,

    if I use
    count PORTB.0,100,rpm
    the result is poor quality ,

    if I use
    count PORTB.0,1000,rpm
    the result is very slowly ,

    if I use hardware capture resolve all that problems ?

    how can I use this ?
    any body trying ?

    regards

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    COUNT is dependant on the oscillator speed. I don't know what speed you're running, but might help one of those cases if you bumped up the clock speed until you get what you want (maybe)...

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


    Did you find this post helpful? Yes | No

    Wink Count the convenient value ...

    Hi, Miniboost

    Real world rpm happen in a ... minute !!! ( Mr de la Pallice )

    if you want to count in a 1/10 of a second you count ... 15 counts for 9000 rpm ( let's be VERY optimistic !!! ) as tey are INTEGER counts ... you do with 14,15 or 16 .... never 15.238656

    Ok ... let's try other methods ...

    measure the period ... ahhh, better !!!

    with a 4 Mhz clock, using the CAPTURE module of a pic ( 16F628 or 876 i.e ) ... you can have a 1µS resolution ... say 65535 µS period to the max.

    Boooo ... can't measure less than 915 rpm !!!

    sooo ... let's look at TMR1 prescaler values ... 2 will fit ( 457 rpm ... ok ) also have 4 ...

    max rpm resolution ???

    9000 rpm is 6.7 ms period ... 3350 TMR1 counts ( W/ prescaler of 2 ) ... say better accuracy than 0.1 %

    Now, let's read something clear !!! ... you'll have to use a mean value over a reading period of .5 to 1 sec ... if you do not want the display to flicker too much !!!

    but you can also add a fast + mean bargraph ....

    Will be another story !!!

    Alain

    PS: no hardware capture function in PbP ... have to write it yourself ...
    Last edited by Acetronics2; - 4th April 2007 at 15:52.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  4. #4
    Join Date
    Nov 2006
    Location
    ist
    Posts
    13


    Did you find this post helpful? Yes | No

    Red face

    hello again friends ,
    I want make a fast rpm meter ,you understand me ofcourse ,

    now I just trying on my car ,its my first dynamic test for this.
    Im connect pic`s (portc.2) to car ecu rpm out .
    (its same to dash board tacho in )

    pic is 16F876-20
    osc is 4 mhz ,I can easly rise up but I thing its not enough ..
    when I use count 1000 command ,I can read on the lcd "35" every second .

    then I change setting ..
    35*60/2=1050 rpm ..
    its near real rpm ..
    I read on the tacho 1000 rpm ..
    1000/60 =16.6
    16.6*2 =~33.2 I think

    So ,count command is very slow .

    @skimask ,
    Its very easy for me ,
    I can try with 20 mhz osc .
    Can I try ?

    @Acetronics ,
    Yes ,
    I must write my hardware capture command ,
    but question is HOW
    I understand your comment ,
    if I write that codes and If I use 4mhz osc ,
    I can easly and faster read on my lcd 1000 to 9000 rpm ?

    Tonight Im read 16F876 pdf file and work some new codes .



  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Post

    [QUOTE=MaxiBoost;Yes ,
    I must write my hardware capture command ,
    but question is HOW
    I understand your comment ,
    if I write that codes and If I use 4mhz osc ,
    I can easly and faster read on my lcd 1000 to 9000 rpm ?

    [/QUOTE]

    How ...

    Take 876 Datasheet on $ 8.0, 8.1 ... CCP modules ...

    an see which registers you have to deal with ...

    For a first trial ... i suggest you to poll the interrupt flag rather than use an interrupt ...

    for speed ... Haha ... the time is that of 1 rotation or time between two sparks ( half a rotation ...if i'm right !!! )

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

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    the time is that of 1 rotation or time between two sparks
    Alain
    What if I've got a diesel?

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


    Did you find this post helpful? Yes | No

    Talking READ Before WRITE ... is not only for EEPROM ...

    Hi Skimask

    You get the right to come back for 2nd week challenge !!! ...

    1 rotation ... fits Diesel ALSO !!!

    Ok ... can try to get the 3 phases from alternator ... but I read somewhere in this thread : ECU rpm output ...

    France : 2 more points !!!

    LOL !!!
    ************************************************** ***********************
    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. remote code learning
    By Bruce in forum Code Examples
    Replies: 20
    Last Post: - 21st February 2021, 16:38
  2. mS Timer
    By whmeade10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th September 2020, 13:12
  3. Using hardware capture
    By Bruce in forum Code Examples
    Replies: 14
    Last Post: - 25th March 2012, 06:52
  4. Using CCP1 and CCP2 to measure instant fuel consumption
    By srspinho in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 20th September 2008, 16:50
  5. Measuring change of frequency with PIC
    By Aussie in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th July 2007, 02:47

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