Posted: Thu Oct 09, 2008 5:50 pm
In that case you could try this:
7908 / (pulsin / 10)
This will return the following:
1.2067 mph = 1.21
1.875mph = 1.88
3.75mph = 3.75
7.50 = 7.50
15.00 = 15.00
30.00 = 30.00
60.00 = 60.00
120.00= 120.00
You can recover the remainder using modulo division and then create an integer value from 12 (for 1.2mph) to 1200 (for 120.0mph) by appropriately scaling the two results.
You will still need to do the overflow check, which means that the speedo won't read below about 1.2mph. Your best bet might be to trap values that equate to less than 1.5mph, or perhaps 2 mph, and return zero.
Jeremy
Jeremy
7908 / (pulsin / 10)
This will return the following:
1.2067 mph = 1.21
1.875mph = 1.88
3.75mph = 3.75
7.50 = 7.50
15.00 = 15.00
30.00 = 30.00
60.00 = 60.00
120.00= 120.00
You can recover the remainder using modulo division and then create an integer value from 12 (for 1.2mph) to 1200 (for 120.0mph) by appropriately scaling the two results.
You will still need to do the overflow check, which means that the speedo won't read below about 1.2mph. Your best bet might be to trap values that equate to less than 1.5mph, or perhaps 2 mph, and return zero.
Jeremy
Jeremy