#REM
There are 4550 wheel sensor pulses per mile traveled for the Insight,
we are reading pulses per 1/4 second
s = speed in MPH
x = pulses per second
s = (x*360)/455
Should give pulses per hour, divided by pulses per mile, to give you a mile per hour figure
so for 60mph reading would be reading about 76 pulses per second
Speed Mph = (X*360)/455
The maximum pulses per second the 16 bit speed maths can stand is 180 which equates
to a speed of 142 mph
If you exceed 142mph the speedo will be incorrect/overflow (read low) during that second
Now we need Distance in feet travelled in that second
Distance ft per second = (X*528)/455
To keep a running total of feet travelled
Distance = Distance + (X*528)/455
When Distance = 5280ft (1 mile) increment odometer and start again
The maximum pulses per second the 16 bit distance maths can stand is 124 which equates
to a speed of 98mph
If you exceed 98mph the distance will be incorrect/overflow (read low) during that second
#ENDREM
CheckSpeed:
CountW = 0 ;Set Local Variable CountW to 0 (Zero)
Count SpeedSensor,500,CountW ;Measure speed by counting VSS pulses for 250ms (Vehicle Speed Sensor)
CountX = CountW * 1440 / PulsePerMile ;Calculate Speed in mph (Speed stored in CountX)