PIC16F84A Tachometer LED routine


Results 1 to 21 of 21

Threaded View

  1. #10
    Join Date
    Oct 2008
    Location
    Denmark
    Posts
    10


    Did you find this post helpful? Yes | No

    Default

    I really think somethings wrong with the math. I just can't figure it out :/

    Now an example:
    Code:
    MAIN:
            W1 = W1 * 2                    ' To get whole period
            W1 = W1 * 4                    ' now the count is in mS
            W1 = (60000/W1)                ' Revs per 60 mS
            W1 = W1 * 1000                 ' Revs per minute
                GOSUB display              ' Go to display sobroutine       
            GoTo LOOP                      ' Do forever
    The input has a period of 12 mS (5000 RPM) - Which is 1500 increments @ 4µS.
    As I only measure the low part of the 50% duty-cycle, I multiply with 2. Full period.
    Then I multiply with 4. Now it's in mS. 12,000.
    60,000 / 12,000 = 5.
    5 * 1000 = 5000 RPM. NICE! - But i doesn't work.

    I have seriously no idea of why this shouldn't work.

    EDIT:
    And then i thought. Figure out when i goes wrong:
    So i tried to make the calculations. With a number, that wouldn't go straight up into 60,000. Example: 2000.
    2,000*2=4,000
    4,000*4=16,000
    60,000/16,000=3.75 <- I guess this is were the PIC can't follow my lead.
    3.75*1,000= 3750.
    Last edited by ThaSanta; - 20th October 2008 at 01:06. Reason: Adding more info
    / Lerche

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. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  3. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  4. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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