PBPro Maths Help


Results 1 to 9 of 9

Threaded View

  1. #1

    Default PBPro Maths Help

    Dear All

    I have some old code i use to calaculate vehicle speed in mph from a pulsing speed sensor.

    Code:
     
    CheckSpeed:     'Pulsin measures VSS pulse. In no pulse in the timeout, result will be 0 
     pulsin VSS,1,Local   'Measure length of a VSS pulse in 5us (8mhz) units (Timeout 0.32768s)
     if Local = 0 then JumpSpeed  'If Local = 0 pulsin has timed out and vehicle is moving at < 1.5mph
     Local = Local / 11   'Divide Local by 11 to enable results to fit into 16 bit Integer Maths
     ActualSpeed = (7908 / Local) + 1 'Returns Speed in mph accurate to 1 mph Approx!
    I am constrained by the 16 bit maths but am sure there will be a better way with the pbpro maths experts to code my formula. The code above works but is a bit inacurate and I end up adding 1mph on at the end to get it something like right. Any ideas please.

    ASFAIK the VSS speed sensor outputs around 4000 pulses per mile
    Last edited by retepsnikrep; - 30th April 2011 at 01:56.

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