Professional Documents
Culture Documents
h>
//////////////
////////////////////////
//RPM///////////////////////////////////////////////////////////////////////////////////////////////
//Airflow///////////////////////////////////////////////////////////////////////////////////////////
const double Kt = 1;
//startingfuel//
//vetable//
// RPM 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 5500 6000
{ //MAP
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} , //40
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} , //50
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} , //60
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} , //70
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} , //80
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} , //90
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} , //100
{80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80} //110
};
//MAP///////////////////////////////////////////////////////////////////////////////////////////////
//allign map//
//TPS///////////////////////////////////////////////////////////////////////////////////////////////
//Oil pump//////////////////////////////////////////////////////////////////////////////////////////
//Serialmon/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////NILRTOS////////////////////////////////////////////////
//------------------------------------------------------------------------------
void setup()
Serial1.begin(9600);
pinMode(oilPUMP, OUTPUT);
TCCR3A = 0; // normal mode
TCNT3 = 0;
//------------------------------------------------------------------------------
void loop()
periodz = (1000/rps);//ms
injectDelayTime = 3;
AF = sfueltime*62.5;
else
AF=(1.25*VE*MAP*rpm*Ka)/(InjSpec*157476.7782);
injectOnTime = (AF+TPS)*62.5;
count = 0;
}
//MAP//////////////////////////////////////////////////////////////////////////////////////////
RAWMAP = analogRead(A0);
VMAP = ((RAWMAP*5)/1023);
highMAP = VMAP;
initialMAP = 0;
MAP = (1/0.045)*(VMAP+0.425);
//TPS//////////////////////////////////////////////////////////////////////////////////////////////
RAWinTPS = analogRead(TPSpin);
RAWinTPS = minTPS;
RAWinTPS = maxTPS;
TPS = ((outTPS*Kt*1000)/(14.7*InjSpec));
//TPS = 0;
Serial1.println("AF");
Serial1.println( rpm );
Serial1.println("map");
Serial1.println(MAP);
Serial1.println("injectOnTime");
Serial1.println(injectOnTime);
ISR (TIMER3_COMPA_vect)
if (injectOn)
injPulVal = 0;
}
else
pmpPulVal = 1;
if(alternate == 0)
injPulVal = 1;
if (count == 1)
countr++;
TCCR3B |= (1 << WGM32); // Turn on CTC mode (so it will start again) automatically
OCR3A = injectOnTime;
alternate = 1;
TCCR3B |= (1 << WGM32); // Turn on CTC mode (so it will start again) automatically
alternate = 1;
initialInj = 0;
injPulVal = 1;
else
injPulVal = 0;
alternate = 0;
/////////////////////////ngat
void reinject ()
Serial.println(rpm);
TCCR3B |= (1 << WGM32); // Turn on CTC mode (so it will start again) automatically
if (half_revolutions >= 1) {
timeold = micros();
half_revolutions = 0;
void fInject()
interrupts ();
the next */
incrementr = 6000/12;
indexr = 0;
/* find which array element corresponds the the rpm value */
indexr++;
return indexr;
incrementm = 110/11;
indexm = 0;
// int MAPcompare = ;
indexm++;
return indexm;