Quote:
Originally Posted by takarp
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