View Single Post
Old 11-13-2012, 03:30 AM   #1026 (permalink)
AndrzejM
Master EcoModder
 
AndrzejM's Avatar
 
Join Date: Oct 2011
Location: Poland
Posts: 840

Berta - '97 BMW 318 tds Compact
90 day: 62.03 mpg (US)

Charlie - '07 Citroen C4 Grand Picasso Exclusive
90 day: 37.58 mpg (US)

Corsa - '05 Opel Corsa C
90 day: 53.22 mpg (US)

Mruczek - '03 Audi A2
90 day: 60.61 mpg (US)
Thanks: 185
Thanked 167 Times in 117 Posts
Quote:
Originally Posted by takarp View Post
Thnks for the quick reply!

If I stop the engine, everything goes 0, but when the engine is running the l/km instantly goes 999999 and the tank value starts to rise. It seems when the speed 0, the program won't stop to update the tank data, it continues to add the infinity to the tank avarege.
Man! That's perfectly normal. As you know fuel consumption is a function of distance and fuel used. If you are using fuel and you're not moving the fuel usage in l/km goes to infinity. And the other way around when you are moving and not using fuel (your engine is off for example) your fuel efficency goes to infinity (0 l/km), regardles the speed.

It's just dividing by zero math.

So your MPGuino works perfectly normal and it should be that way! Don't change the code!


Quote:
I have two other things:
-my arduino has 16 mhz chrystal, if I change the code for 16 mhz the tank and current values will be different even after an instant tank reset. If I leave it 20 mhz, i'm unable to calibrate vss, if the speed ok, the distance wrong, if the distance ok the speed has more than 10% error.
-after calibrating the vss well, it indicates very vell under 60 km/h, but when I go to highway, the speed indication not rises above 70-80 km/h, and it's jumping around. I tuned the vss delay with no success.
There is a part of the code that is adjusting MPGuino to work with different crystals. See below:

Code:
//use with 20mhz
#define cyclesperhour 4500
#define dispadj 800
#define dispadj2 1250
#define looptime 1250000ul/loopsPerSecond //1/2 second
#define myubbr (20000000/16/9600-1)
#define injhold (parms[injectorSettleTimeIdx]*5)/4

#define outhi(port,pin) PORT##port |= ( 1 << P##port##pin )
#define outlo(port,pin) PORT##port &= ~( 1 << P##port##pin )
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

//use with 16mhz, not tested
//#define cyclesperhour 3600
//#define dispadj 1000
//#define dispadj2 1250
//#define looptime 1000000ul/loopsPerSecond //1/2 second
//#define myubbr (16000000/16/9600-1)
//#define injhold parms[injectorSettleTimeIdx]

Hope this helps
__________________


Quote:
Gerhard Plattner: "The best attitude is to consider fuel saving a kind of sport. Everybody who has enough money for a strong car, can drive fast and hit the pedal. But saving fuel requires concentration, self-control and cleverness. It's a challenge with the nice effect of saving you money that you can use for other more important things."
  Reply With Quote