8051 Code
John Dammeyer
johnd at autoartisans.com
Wed Mar 29 15:43:14 GMT 2000
> Date: Wed, 29 Mar 2000 12:33:12 +0100
> From: Corner Paul <Paul.Corner at icl.com>
> Subject: 8051 EFI code
>
> Hi John
>
> Any chance you would like to share the algorithms or some of the source code
> ?
> I've looked at Al Lipper's work - the core routines aren't that different to
> what I had allready coded.
>
> Regards, Paul.
Hi Paul,
Can't distribute code as I'm bound by NDA but I can talk about it a bit. I based my code
on Al Grippo's paper along with the series of articles in Circuit Cellar Ink.
In other words, I used a Volumetric Efficiency table approach rather than the MAP-RPM 2-D
table. I have parameters like Displacement, number of cylinders and injector size along
with Fuel/air ratio to determine the baseline 100% VE fuel required on a per stroke basis.
I guess at Vapour pressure because I don't measure RH.
Given X amount of air in the cylinder at atmospheric pressure I then have the amount of
fuel (F) the engine requires. The MAP divided by the Barometer forms a ratio less than
1.0 and the VE table is in percent so the basic equation is simply (X+F) * MAP/Barometer *
VE[RPM].
I have a mainline loop that continuously calculates these values along with acceleration
and temperature enrichments and updates a global pulse width variable. The main loop just
reports status out the CAN bus and recalculates PW based on the A/D values which are
triggered to also update via interrupts.
We have two HALL sensors underneath the CAM timing pulley which are switched by 4 magnets
set at 90 degrees to each other to create a Grey Code encoder. This tells me from the bit
pattern: 00, 01, 11, 10 which cylinder is at TDC and creates an interrupt on each single
bit change. Notice the Grey Code only has one bit that ever changes so an interrupt is
fairly easy to decode into a quadrant. The down side is the CAM has to make one complete
revolution after power up before the sensors report the correct values as they are
latching sensors where a North magnetic pole turns them on and South turns them off and
they come up in an unknown state. It means at worst case the engine cranks two
revolutions before starting.
I chose the 80C592 because it has enough compare registers to assign one per injector and
coil pair and of course comes with CAN bus. The rest of the code is just house-keeping to
make the injectors and coils fire at the right time. I've done empirical tests and found
that up to about 4000RPM I'm updating the PW once per injector squirt after that I start
to lag behind but we haven't found that to be a hindrance as an unloaded engine winds up
to redline far faster than I can pull the throttle back and a fully loaded engine doesn't
change load on a per stroke basis.
To tune the engine we've determined the best way is to set the dyno, (or propeller) to
load the engine enough so that the throttle is wide open at a number of different RPM
settings. (1500, 2000, 2500, 3000 ...). During this time we tweak the VE table values
till the O2 sensor starts dancing around 0.5V. With a bit of extrapolating we end up
filling in the VE table between those values (100RPM steps) and end up with values from
about 45% up to 95%. For values less than WOT the MAP/Barometer ratio seems to keep the
mixture fairly even. This beats filling in a
Lookup[RPM,MAP] table with hundreds of values.
Enrichments are done by monitoring engine temp, air temp and the TPS.
What is really cool is that when we put in bigger injectors the only thing we change is
the size of the injector and the engine runs with shorter pulse widths but the mixture is
just about spot on. One other parameter that affects the low end idle and overall mixture
is the open/close time of the injector. We guess that 66% of the rated fuel is delivered
during this time so if we need 4ms fuel and the open/close time is 3ms then we need a 5ms
pulse.
i.e.: PW = Desired rate - (OpenTime*.66666) + OpenTime.
or PW = 4ms - (3ms * 0.66666) + 3ms ==> 4ms - 2ms + 3ms ==> 5ms.
Change to Lucas Disk Injectors from Pintle Injectors and that formula changes because the
Lucas open faster.
I'd like to say .. simple eh? .... but it wasn't and we still have little glitches that
are unsolved but I suspect are mechanical or electrical rather than software.
Cheers,
John
----------------------------------------------------------------------------
To unsubscribe from diy_efi, send "unsubscribe diy_efi" (without the quotes)
in the body of a message (not the subject) to majordomo at lists.diy-efi.org
More information about the Diy_efi
mailing list