Truth Tables


Closed Thread
Results 1 to 1 of 1

Thread: Truth Tables

  1. #1
    Join Date
    Mar 2004
    Posts
    44

    Default Truth Tables

    (16f877 @20Mhz)
    I 'm reading an incoming pulse and need to convert this to MPH.
    I need to read the speed in under 250ms so I looked at using the code posted by Darrel Taylor

    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

    Compared to using the COUNT function over a 1sec period the above method doesn't seem to give a very linear result. (although I'm not sure why)

    So I was wondering if I could use the Pulsin to look at the high & low times then add these together and then search a table for the appropriate MPH.

    I guess I would need 150ish entrys in the table is this feasable?

    For the techies out there
    I have a pic generating a test pulse of 488.8Hz and the signal is 50% duty cycle.

    At 488.8Hz the Total_Pulse = 1021
    At 247.1Hz the Total_Pulse = 2021
    At 165.4Hz the Total_Pulse = 3022
    At 124.3Hz the Total_Pulse = 4022
    At 99.5Hz the Total_Pulse = 5022
    At 76.6Hz the Total_Pulse = 6522
    At 71.2Hz the Total_Pulse = 7022
    At 62.3Hz the Total_Pulse = 8022
    At 54.4Hz the Total_Pulse = 9022
    At 49.8Hz the Total_Pulse = 10021
    At 29.9Hz the Total_Pulse = 20021
    At 20.0Hz the Total_Pulse = 25021
    At 16.6Hz the Total_Pulse = 30022

    Just as I was taking these readings I notice they all end in 21/22?
    Am I doing something wrong?
    If it makes any different I'm using PORTA.4

    Rob
    Last edited by Rob Martin; - 13th April 2005 at 17:59.

Similar Threads

  1. Re:The Truth about Chernobyl Via Melanie
    By emmett brown in forum Off Topic
    Replies: 1
    Last Post: - 15th August 2006, 08:25
  2. more than 8 bit for tables in flash (16F87x)
    By BigWumpus in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 18th May 2006, 03:15
  3. Using large lookup tables
    By speck in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th April 2006, 21:40
  4. 18f452 tables in ram - code?
    By rshanks in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st October 2004, 05:06
  5. write tables
    By Ruben Pena in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st August 2004, 20:09

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