16F877@4Mhz calculate Pulsin to RPM


Results 1 to 25 of 25

Threaded View

  1. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Leigh,

    From your two values of 165 and 168, I calculate that the engine was running at 4504 RPM. So, the following formula may be what your looking for.
    Code:
    Pulse_High  Var  word
    Pulse_Low   Var  word
    Pulse_Total Var  Word
    RPM         Var  Word
    
    Pulse_High = 165
    Pulse_Low  = 168
    
    Pulse_Total = Pulse_High + Pulse_Low
    RPM = 1000
    RPM = RPM * RPM           ' Preload internal registers with 1,000,000
    RPM = DIV32 Pulse_Total   ' 1,000,000 / Pulse_Total
    RPM = RPM * 60            ' Per minute
    RPM = Div32 40            ' 4 pulses per rev
    
    lcdout $FE,1,dec RPM
    In normal math it might look like this:
    (1,000,000/(Pulse_High+Pulse_Low))*60/40

    A better way to take the measurements might be to use the Capture mode of the CCP module. Set the prescaler to 2:1 and have it count 4 rising edges of the input and then generate an interrupt. The Timer value would contain 1/2 the number of uS it takes for 1 revolution, which should be fairly easy to convert to RPM. This way, the processor can continue doing other things while it's taking the measurement. This should work from 500-10,000 RPM

    That's a bit more complicated, but may be worth looking into.

    HTH,
       Darrel
    Last edited by Darrel Taylor; - 18th April 2004 at 22:05.

Similar Threads

  1. Interrupt RPM and Taylors Elapsed time on 18F4620
    By Tobias in forum mel PIC BASIC Pro
    Replies: 70
    Last Post: - 3rd February 2010, 16:12
  2. Slow code needs a tune up
    By Tobias in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th January 2010, 15:05
  3. Pulsin vs. Interrupt RPM measurement
    By Tobias in forum General
    Replies: 1
    Last Post: - 31st December 2009, 01:29
  4. 16f877A and tmr1 external crystal question
    By comwarrior in forum General
    Replies: 3
    Last Post: - 13th July 2009, 00:40
  5. RPM - DIV32 Problem
    By davewanna in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th April 2008, 04:33

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