DIY PROM Do It Yourself PROM chip burning help. No PROM begging. No PROMs for sale. No commercial exchange. Not a referral service.

What do you think of this?

Thread Tools
 
Search this Thread
 
Old Sep 28, 2004 | 02:40 AM
  #1  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
What do you think of this?

To start off with, this is a long post so if your in a rush, better off moving on...

This is my first time around at actually writing real engine management code. The thing Im trying to do is replace the base pulse width as calculated by the VE, MAP, etc with one calculated by a MAF. The MAF goes up to around 480 grams per second or so so the MAF is stored in two parts. L00C7 will have up to 255 grams a second while L00C8 will have the additional flow thats above 255 grams per second. The injector constant is one divided by the flowrate in grams per second of one of the tbi injectors times 1024. I think thats correct...

I also made the cranking fuel in terms of pulsewitdth with respect to temperature since the MAF wont read that low and the calc with the dist. reference period will flood out below around 240 rpms.

Anyone see logic flaws or mistakes I might have made? Is the math right? Any way of improving it?

Last edited by dimented24x7; Sep 28, 2004 at 02:58 AM.
Reply
Old Sep 28, 2004 | 02:42 AM
  #2  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Code:
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Engine run a go, time to build the BPW
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
;
;           16 x DRP x (Low MAF + High MAF) x (inj. const. x 1024)          
;BPW = 4 x -------------------------------------------------------- x AFRinv x AFR scalar x ...
;		                  65536                                 
;
;      BLM corr. x DFCO x decel. enlean x FPV corr. +/- INT prop term
;      
;
;
LD6F0	LDAA	L0001		;Status word
	BMI	LCRK00		;Bra if motor is running
;
;-Engine off, load crank PW instead
;
	LDAA	L00B7		;Crank PW 
	LDAB	LD215		;%TPS threshold for clear flood
	CMPB	L0043		;%TPS
	BHI	LCRK01		;Bra if TPS <=
;
	JMP	LD876		;Bra to cut the fuel
;
LCRK01	CLRB			;Clr LSB
	STD 	L004B		;Store it
	LDAA	LCRKP00		;Load crank Pw scalar
	LDX	#L004B		;Tmp storage
	JSR 	LFC0C		;(A x X*)/256
	JMP	LMAF07		;Jump to save
;
;-Engine running
;
LCRK00	LDD 	L0018		;DRP's
	LSLD			;x2
	BCS	LMAF00		;Bra if overflow
;
	LSLD			;x2
	BCS	LMAF00		;Bra if overflow
;
	LSLD			;x2
	BCS	LMAF00		;Bra if overflow
;
	LSLD			;x2
	BCC	LMAF01		;Bra if no overflow
;
LMAF00	LDD	#$FFFF		;Clr overflow
;
LMAF01	STD	L004B		;Store it, tmp storage
	LDAA	L00C7		;Low MAF airflow, gms/sec
	LDX	#L004B		;DRPs x 4
	JSR 	LFC0C		;(A x X*)/256
	STD 	L00AE		;Store it, BPW	
;
	LDAA	L00C8		;High MAF airflow, gms/sec 
	LDX	#L004B		;tmp storage, DRP x 4
	JSR	LFC0C		;(A x X*)/256
	ADDD	L00AE		;Add in the stored DRPs x Low MAF
	STD	L00AE		;Save it, BPW
;
	LDAA	L00A9		;Injector const., inv flowrate x 1024
	BSR	LD73D		;Bra to multiply it in
;
;~~~~~~~~~~~~~~~~~~~~
;-Inverse AFR lookup
;~~~~~~~~~~~~~~~~~~~~
;
	LDAA	L00A6		;Desired AFR
	CMPA	#$00A0		;16.0 AFR
	BCC	LMAF02		;Bra if AFR >= 16.0
;
	CMPA	#$0050		;8.0 AFR
	BCC	LMAF03		;Bra if AFR >= 8.0
;
;-AFR < 8.0
;
	CLRB			;No offset
	LDX	#LAFRHIT	;Address of uppermost table of AFRinv x 256 
	BRA	LMAF04		;Jump to add it into the BPW	
;
;-8.0 <= AFR < 16.0
;
LMAF03	LDAA	LAFRMDC		;AFRinv scalar
	BSR	LD73D		;Go add it in
	LDAB	#$0050		;8.0 AFR offset
	LDX	#LAFRMDT	;Address of middle table of invAFR x 2048
	BRA	LMAF04		;Bra to add it into the BPW
		
;
;-16.0 <= AFR
;
LMAF02	LDAA	LAFRLOC		;AFRinv scalar
	BSR	LD73D		;Go add it in
	LDAB	#$00A0		;16.0 AFR offset
	LDX	#LAFRLOT	;Address of lowermost table with invAFR x 4096 
;
LMAF04	JSR	LFB77		;2D lookup with SBA
	LDX     #L00AE		;sync BPW
        JSR     LFC0C		;(A x X*)/256
	LSLD			;x2
	BCS	LMAF05		;Bra if overflow
;
	LSLD			;x2
	BCC	LMAF06		;Bra if no overflow
;
LMAF05	LDD	#$FFFF		;Clr overflow
	JMP	LD878		;Bra to store the BPW
;
LMAF06  STD     L00AE		;Save BPW

Note: LD73D is (accumulator A x the base pulse width
pointed to by the index register X) / 256.

Last edited by dimented24x7; Sep 28, 2004 at 02:48 AM.
Reply
Old Sep 28, 2004 | 02:44 AM
  #3  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Here are the AFR tables....

Code:
;
;~~~~~~~~~~~~~~~~~~~~
;-inverse AFR tables
;~~~~~~~~~~~~~~~~~~~~
;
LAFRLOC	FCB	 16		;Low AFR scalar
;
;	   AFRinv x 4096  	;AFR
;
LAFRLOT	FCB	255		;16.0
	FCB	232		;17.6
	FCB	213		;19.2
	FCB	197		;20.8
	FCB	183		;22.4
	FCB	171		;24.4
	FCB	160		;25.5 
;
LAFRMDC	FCB	 32		;Mid AFR scalar 
;
;	   AFRinv x 2048	;AFR
;
LAFRMDT	FCB     255    		; 8.0
	FCB	213		; 9.6
	FCB	183		;11.2
	FCB	160		;12.8
	FCB	142		;14.4
	FCB	128   		;16.0	 
;
;	   AFRinv x 256		;AFR
;
LAFRHIT FCB	255		;   0
	FCB	160		; 1.6
	FCB	 80		; 3.2
	FCB	 53		; 4.8
	FCB	 40		; 6.4
	FCB	 32		; 8.0
Reply
Old Sep 28, 2004 | 02:51 AM
  #4  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
This is only a portion of it, I still have yet to work on reading the MAF in or having some form of error handling and sensor checking.
Reply
Old Sep 28, 2004 | 10:26 AM
  #5  
funstick's Avatar
Supreme Member
 
Joined: Jun 2002
Posts: 1,787
Likes: 0
From: great lakes
well what type of MAF are you using for this ? there maybe harware challenges to overcome.

as for the MAF itslef. youll need some good filtering algortyhms. id sample the actual MAf on every clock cycle for 4 clock cycles then add the 4 readings together and then divide for an average. this should help with intake tract noise generation. i doubt the state of the engine could even change in 4 clock cycles if you removed alot of the other crap running on the minor loops like EGR.

your gonna run MAF with a tbi. ive always wanted to do that.

how do you plan on handling the AE and what not ?

i wonder if the MCU is robust enough to handle doing a software model of the intake. would be so much more efficient.
Reply
Old Sep 28, 2004 | 11:08 AM
  #6  
1981TTA's Avatar
Member
 
Joined: May 2004
Posts: 289
Likes: 0
From: SE Michigan
Car: 81 Turbo Trans Am
Engine: 301 T
Transmission: 200-4R
Your approach should work well for relatively constant throttle/airflow. But, you'll have to take care of "erroneous" airflow values that will be present during large MAP transients. (You might be able to do this with some creative filtering approaches....?) Since the MAF sensor only tells you the airflow into the intake manifold, you have to do something about conditions when the airflow out of the intake manifold isn't equal. This happens whenever there's a change in MAP. The larger the change, the larger the "error".

If you have the ability to plumb the MAF sensor and collect data while still using the VE tables, you should be able to see what would happen. Then, given that information, determine whether filtering or some other approach might help.

While I haven't gone through the math/logic yet, I have to say I'm impressed with your effort/work on this! :hail:
Reply
Old Sep 28, 2004 | 04:01 PM
  #7  
funstick's Avatar
Supreme Member
 
Joined: Jun 2002
Posts: 1,787
Likes: 0
From: great lakes
Originally posted by 1981TTA
Your approach should work well for relatively constant throttle/airflow. But, you'll have to take care of "erroneous" airflow values that will be present during large MAP transients. (You might be able to do this with some creative filtering approaches....?) Since the MAF sensor only tells you the airflow into the intake manifold, you have to do something about conditions when the airflow out of the intake manifold isn't equal. This happens whenever there's a change in MAP. The larger the change, the larger the "error".

If you have the ability to plumb the MAF sensor and collect data while still using the VE tables, you should be able to see what would happen. Then, given that information, determine whether filtering or some other approach might help.

While I haven't gone through the math/logic yet, I have to say I'm impressed with your effort/work on this! :hail:
well that is what i was talking about with the AE function. making it a model of the intake manifold and runner lenght. i think if codded properly it could really produce excelent results for Ae modes.
Reply
Old Sep 28, 2004 | 04:32 PM
  #8  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
The AE will be handled by the standard MAP/TPS based AE routines that are already in there. Id much rather use them than anything based on MAF since theyre simpler and work quite well. MY main objective is to generate a core pulsewidth for the injectors using a MAF instead of using all the "SD" tbi stuff. Everything else like the spark table will still use the MAP. I definatly plan on some form of filtering but Im nearly out of RAM from other add-ons so Ill have to move some things around to make space for the additional maf stuff.

As far as the MAF, Ill be using an F-body LS1 MAF. New one is around a $110 so I guess I wont be out a fortune if it doesnt work as planned. I found MAF tables and a basic description of how the MAF works so I guess Ill build a freqency to voltage converter and use one of the A/D inputs. The only real problem with that is that there will be about a 4% error either way at very low airflows (~3.5 g/sec). The maf output is actually just a transister switching to ground. In the pcm, there is a resister tied into a +5 volt source and the grounding/opening of the circuit generates a 0/+5 volt square wave.

Last edited by dimented24x7; Sep 28, 2004 at 04:37 PM.
Reply
Old Sep 28, 2004 | 04:36 PM
  #9  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Would be nice to have some sort of modeling built in. As it is Im already pushing the envelope of what the old 6809 can do so itll have to be a bare bones system. The origional TBI code was a bit coarse so maybe the variences wont be as noticable when I chagne over.
Reply
Old Sep 29, 2004 | 07:50 AM
  #10  
JPrevost's Avatar
Senior Member
 
Joined: Oct 1999
Posts: 6,621
Likes: 2
Car: 91 Red Sled
Axle/Gears: 10bolt Richmond 3.73 Torsen
Sounds confusing .
Since you're romless, have you tried RBob's ultimate TBI code yet? Just curious.
Reply
Old Sep 29, 2004 | 03:35 PM
  #11  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Car isnt running at the moment so I havnt had a chance to try anthing much else with it. Ill have to try it when I get my car running again.

In addition to a couple of errors I just spotted looking that over again, I also have to figure out a way to represent smaller increments then just grams, like 10ths of a a gram, or 16ths of a gram while also being able to work within the confines of an 8 bit ecm. Back to the MAF hacks to look for inspiration. Of course, some of them arnt even really commented since they where made some time ago.
Reply
Old Sep 30, 2004 | 02:20 AM
  #12  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Oh man, this is harder then I thought!

I had to make the MAF a 16 bit value in order for it to be grams/sec x 16, use a 16 bit scalar value for the MAF tables as well as make some modifications to the lookup routine I stole from a MAF calibration, write a 16 bit by 16 bit multiplication routine so I can work with two 16 bit values, add in MAF error handling and I still have yet to add in any stuff to do some sort of n-alpha mode if the MAF breaks. I dont know what to do about that. Maybe a 3D-table with MAF values thats based on TPS and RPMs.

I hope thats all Ill need to use it because my fuel loop is PACKED SOLID! It may even be overrunning the loops for all I know. I had to take out the DFCO stuff to make some more time.

Last edited by dimented24x7; Sep 30, 2004 at 02:23 AM.
Reply
Old Oct 2, 2004 | 06:43 PM
  #13  
funstick's Avatar
Supreme Member
 
Joined: Jun 2002
Posts: 1,787
Likes: 0
From: great lakes
Originally posted by dimented24x7
Oh man, this is harder then I thought!

I had to make the MAF a 16 bit value in order for it to be grams/sec x 16, use a 16 bit scalar value for the MAF tables as well as make some modifications to the lookup routine I stole from a MAF calibration, write a 16 bit by 16 bit multiplication routine so I can work with two 16 bit values, add in MAF error handling and I still have yet to add in any stuff to do some sort of n-alpha mode if the MAF breaks. I dont know what to do about that. Maybe a 3D-table with MAF values thats based on TPS and RPMs.

I hope thats all Ill need to use it because my fuel loop is PACKED SOLID! It may even be overrunning the loops for all I know. I had to take out the DFCO stuff to make some more time.
even with all the 16bit math your still working with an 8 bit A/D converter. as i siad from the start. you may find it more advantageous to use the MCU to count up and down one stepp from the current step and then average it out. would take up far less clock. so you have a max resolution of 255 bits. so if you figure a sensor with a range of 2000hz to 11,000 hz divided b a range of 9000hz and divde that by the avaiavklbe bit in the a/d you have a resoultion of 35 hz give or take the decimal places.

now that not a terriably big error. on the range of 3% and with some good fuel trim coding and adaptation built into your code you could easily reduce that to like 1%. the reall issue is the MAF itself. its only going to be accurate to within 3%. trust me on this. ive tested plenty of them. Gm startegy has been blanket averaging. its work extremly well.

so on a 5v scale you have 255 point of table entrys to use. still just build up a enough maf tables to use all 255 points on the a/d use some slide averageing. and lets the MCU do some really basic math. this way youll still have tons of clock left.

as for the Ae modeling.

ill see if i can find the link to the documents on it but even a lowly 6803 running code like i descirbed above should easily be able to hanlde that. and the modeling will use the MAF TPS MAP RPM to model. its some pretty basic math i just dont know the calculations well enough to spit them out myself.
Reply
Old Oct 2, 2004 | 08:52 PM
  #14  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
I noticed a really interesting thing. This is from the MAF tables I have from the newer LS1 MAFs.

Even though the frequency to voltage converter, the lower ranges of this MAF actually have a greater precision then that of the older mafs when I compare the tables I made up to the ones in a MAF ecm.

The tables are set up the same. My first table, which is based off of the LS1 MAF, goes from 2.4 g/sec to 15.2 secs. The stock table with the standard maf goes from 2.4 seconds to 22.3 seconds. The LS1 MAF still provides better resolution at low to mid flowrates even though I can only have 255 bits to represent the flowrate.

Of course, the flowrates get bunched up at high flowrates but I guess thats the price of improved resolution at low flowrates. If someone where to properly use an LS1 MAF with one of the older MAF ecms they could really make a kick *** system, but that would require some coding to be done to get it all to work.

I origionally wanted to use one of the pulse accumulators to count the # of pulses instead of return the period and use that and a time interval to calculate teh flow but I dont know how to really get the hardware I have to do it.

As for the AE, im not too familiar with the math so itll just be based off of the MAP for now.

Hopefully I can actually install the MAF and try it in the near future to see how it really works.
Reply
Old Oct 2, 2004 | 09:00 PM
  #15  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
As for averaging and filtering, the code does interpolate between values to get an intermediate value to reduce error. I have some basic lag filtering of the maf input. It looks like in the MAF code they filter the output instead. Ill have to look at it and see how it works. I cleaned the added code up a bit so I ahve a little more room to work with now.
Reply
Old Oct 23, 2004 | 01:18 PM
  #16  
JPrevost's Avatar
Senior Member
 
Joined: Oct 1999
Posts: 6,621
Likes: 2
Car: 91 Red Sled
Axle/Gears: 10bolt Richmond 3.73 Torsen
Any updates?
Reply
Old Oct 23, 2004 | 03:02 PM
  #17  
Grumpy's Avatar
Supreme Member
 
Joined: Jun 2000
Posts: 7,554
Likes: 1
From: In reality
Car: An Ol Buick
Engine: Vsick
Transmission: Janis Tranny Yank Converter
How are you inputing the MAF?.
The early ecms are designed for low Freq MAF, so you need to change the cap, on that R/C filter.
Reply
Old Oct 24, 2004 | 03:11 PM
  #18  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
As for the code, I went through it and cleaned it up a little bit and finished the error handling by plugging in some of the stuff from the $6E. If youve seen my other thread I got a MAF off of a late model truck for a few bucks. I think it goes up to like 450 something grams/sec. I bench tested it and it seems to work, or generate an output with airflow, anyway. Wasnt quite sure it would since all the intake ducting that was attached to it had dried up mud in it. Mustve come from a vehicle that was in a flood or driven into water.

The MAF itself is easy enough to use. Plug in some juice from the battery and a 10k resistor + 5 volts DC is all thats needed to generate the square wave output with the MAF.

Ill be using a homemade frequency to voltage converter and opening up some of the unused A/D channels as per RBobs suggestion. I hope it all works. I still dont know how to test or tune the converter. I have a DMM with a frequency counter but Im not quite sure what to use as a function generator. Maybe a multivibrator?

Another problem is where to put the MAF. I cant put it too close to the TBI because Im afraid itll get plugged up with varnish like everything else in that area does. Another thing is that the MAF is pretty large so hood clearence would be an issue. I guess Ill put it and the airfilter where the charcoal can was. Probably cooler there, too so I dont have to worry about it being cooked to death by the headers.

Anyway, Im hoping that once I get the tables calibrated to the intake ducting and the MAF the ecm will have a little autonomy as far as teh fueling is concerned. One thing I dont like with SD is the fact that once I change anything like the timing and such, the fueling is off and I have to go back and dial it back in. Not a big deal but it makes changes harder to evauluate since the fueling wanders off after changes.
Reply
Old Nov 21, 2004 | 12:59 PM
  #19  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Alright, codes pretty much done for now as far as Im concerned. Turned out to be alot longer then I thought it would have to be. Had to add in a 24 bit lag filter to deal with filtering. Also added in 16 bit 2D lookup and some other junk. All it all its around 855 cycles to execute on a typical pass through. Around 2x the time needed to go through the stock code that calcs. the BPW.

Hopefully next time I can say how much I like running a MAF.

Heres the code if anyones interested. A similar stratagy could be used to give the other tpi MAF codes a facelift. Kind of a hard mod, though .
Reply
Old Nov 21, 2004 | 01:02 PM
  #20  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Tables and stuff for MAF lookup. Hopefully this wont take up too much space...

Code:
;
;~~~~~~~~~~~~~~~~~~~~~~
;-Filter value for MAF
;~~~~~~~~~~~~~~~~~~~~~~
;
LMAFP00	FCB	 32		;Filter coef.
;
;~~~~~~~~~~~~~~~~~~~~
;-MAF flowrate table
;~~~~~~~~~~~~~~~~~~~~
;
LMAFP01	FCB	 64		;65 line table
;
;	  gms/sec = val / 16	;Counts
;
	FDB	  0		;  0
	FDB	  0		;  4
	FDB	  1		;  8
	FDB	  2		; 12
	FDB	  4		; 16
	FDB	  8		; 20	
	FDB	 12		; 24
	FDB	 18		; 28
	FDB	 26		; 32
	FDB	 35		; 36
	FDB	 46		; 40
	FDB	 59		; 44
	FDB	 75		; 48
	FDB	 92		; 52
	FDB	113		; 56
	FDB	136		; 60
	FDB	162		; 64
	FDB	190		; 68
	FDB	222		; 72
	FDB	257		; 76 
	FDB	296		; 80
	FDB	338		; 84
	FDB	384		; 88
	FDB	433		; 92
	FDB	487		; 96
	FDB	544		;100
	FDB	606		;104
	FDB	672		;108
	FDB	742		;112
	FDB	818		;116
	FDB	898		;120
	FDB	982		;124
	FDB    1072		;128
	FDB    1167		;132
	FDB    1267		;136
	FDB    1372		;140
	FDB    1483		;144
	FDB    1600		;148
	FDB    1722		;152
	FDB    1850		;156
	FDB    1984		;160
	FDB    2124		;164
	FDB    2270		;168
	FDB    2423		;172
	FDB    2582		;176
	FDB    2748		;180
	FDB    2921		;184
	FDB    3100		;188
	FDB    3286		;192
	FDB    3479		;196
	FDB    3680		;200
	FDB    3887		;204
	FDB    4102		;208
	FDB    4325		;212
	FDB    4555		;216
	FDB    4793		;220
	FDB    5039		;224
	FDB    5293		;228
	FDB    5555		;232
	FDB    5825		;236
	FDB    6103		;240
	FDB    6390		;244
	FDB    6685		;248
	FDB    6990		;252
	FDB    7302		;256
;
;~~~~~~~~~~~~~~~~~~~~~~
;-Max MAF flow vs. rpm
;~~~~~~~~~~~~~~~~~~~~~~
;
;	 gms/sec = val x 2	;RPM
;
LMAFP02	FCB	  8		;9 line table	
;
	FCB	 13		;   0
	FCB	 26		; 800
	FCB	 52		;1600
	FCB	 80		;2400
	FCB	104		;3200
	FCB	130		;4000
	FCB	140		;4800
	FCB	160		;5600
	FCB	170		;6400
And the actual code...

Code:
;
;~~~~~~~~~~~~~~~~~~~~
;Lookup MAF flowrate
;~~~~~~~~~~~~~~~~~~~~
;
	JSR     LFC2E		;Go fetch the MAF
	STAA	L007E		;Raw MAF input	
	LDAB	L0007		;Status word
	BITB	#$000C		;Test b2, b3 = MAF errors
	BEQ	LFLO00		;Bra if no MAF errors
;
;-MAF errors, load default MAF
;
	LDAA	L001B		;rpm/25
	LDX	#LERMP11	;Address of default MAF vals
	JSR	LFB72		;2D lookup w/ line count
	LDAB	LERMP08		;%TPS limit for lookup
	CMPB	L0043		;%TPS 
	BCS	LFLO01		;Bra if tps is greater, limit tps	
;
	LDAB	L0043		;Load %TPS
;
LFLO01	MUL			;%TPS x flow factor vs rpm
	STD	L00C7		;MAF flow
;
	LDAA	L00FD		;Current IAC position
	LDAB	LERMP09		;scale factor
	MUL			;IAC pos x scale factor
	ADDD	L00C7		;Add in results from prev calc
	BCS	LFLO02		;Bra if overflow
;
	ADDD	LERMP10		;Add in default MAF offset
	BCC	LFLO03		;Bra if no overflow
;
LFLO02	LDD	#$FFFF		;Clr overflow
;
LFLO03	LDAB	#$0010		;16
	MUL			;(gms/sec x 16)
	BRA	LFLO04		;Bra to save
;
;-No MAF errors, do MAF lookup
;
LFLO00	LDX	#LMAFP01	;Address of MAF table
	JSR	LD2D00		;Jump to do 16 bit 2D lookup		
;
;-Check low MAF bound before save
;
LFLO04	TSTA			;Test MSB of MAF flow
	BNE	LFLO05		;bra if flow >255
;	
	CMPB	#$0030		;3 gms/sec
	BHS	LFLO05		;Bra if gms/sec >= 3 gms/sec, save
;
	LDAB	#$0030		;Load min allowable flow rate
;
LFLO05	STD	L00C7		;Save it, MAF flow
;
;-Slide filter the MAF
;
	LDAA	LMAFP00		;Filter coeff.
	BNE	LFLO06		;Bra if !=0
;
	LDD	L007F		;Load old MAF value
	BRA	LFLO07		;Bra to save
;
; filter coeff x new MAF flow
;
LFLO06	NEGA			;(256 - FC)
	STAA	L004C		;Temp storage
	NEGA			;Get FC back
	LDAB	L00C8		;MAF flow, LSB
	MUL			;FC x LSB
	STD	L004A		;Temp storage
;
	LDAA	LMAFP00		;Filter coeff
	LDAB	L00C7		;MAF flow, MSB
	MUL			;FC x MSB
	ADDB	L004A		;Add in prev result
	ADCA	#$0000		;Perform carry if needed
	STD	L0049		;Save the two upper bytes
;
; (256 - filter coeff) x old stored MAF
;
	LDAA	L004C		;Temp storage, mod. FC
	LDAB	L0081		;B0 of filtered MAF flow			
	MUL			;(256 - FC) x B0
	LSLB			;
	ADCA	#$0000		;Round up if needed
	STAA	L0081		;Save result
;
	LDAA	L004C		;Temp storage, mod. FC	
	LDAB	L0080		;B1 of filtered MAF		
	MUL			;(256 - FC) x B1
	ADDB	L0081		;Add in previous MSB of result
	ADCA	#$0000		;Carry if needed
	STD	L0080		;Save result
;
	LDAA	L004C		;Temp storage, mod. FC	
	LDAB	L007F		;B2 of filtered MAF	
	MUL			;(256 - FC) x B2
	ADDB	L0080		;Add in MSB of previous result
	ADCA	#$0000		;Carry if needed
	STD	L007F		;Save result
;
; filter coeff x new MAF + (256 - filter coeff) x old MAF
;
	LDD	L004A		;Load up saved MAF flow
	ADDD	L0080		;Add in stored old MAF flow
	STD	L0080		;Save it, filtered MAF flow
	LDAA	L0049		;Saved MAF flow
	ADCA	#$0000		;Perform carry
	ADDA	L007F		;Add in old filtered MAF flow
	STAA	L007F		;Save it, B2 of filtered MAF
        LDAB	L0080		;Load in B1 of filtered MAF
	TST	L0081		;Test B0 of filtered MAF
	BPL	LFLO07		;Bra < 128
;
	INCB			;Round up
;
LFLO07	STD	L00C7		;Save it, MAF flow x 16
;
;-Check to make sure gms/sec flow isnt too high, saftey in case of failure.
;
	LDX	#LMAFP02	;addr. of max gms/sec table
	LDAA	L001B		;RPM/25
	JSR	LFB72		;2D lookup w/ line count
	LDAB	#$0020		;
	MUL			;now gms/sec x 16
	SUBD 	L00C7		;stored MAF, gms/sec x 16
	BCC	LFLO09		;Bra  if MAF is less
;
	ADDD	L00C7		;Add MAF back in to get limit back
	STD	L00C7		;Save MAF limit instead
Reply
Old Nov 21, 2004 | 01:05 PM
  #21  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Heres the actual base pulse width calc. The subroutine LD2D00 is a 16 bit 2D lookup routine and LMUL00 is a 16 bit x 16 bit multiplication routine.

Code:
;
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Engine run a go, time to build the BPW
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;
;
;            DRP x (MAF x 16) x (AFRinv x 2048) x (inj. const. x 2048)       
;BPW = .5 x -----------------------------------------------------------  x ...
;		                 256 x 256 x 256                            
;
;      BLM corr. x decel. enlean x FP corr. x fuel pump volts corr. +/- INT prop term
;      
;
;
LD6F0	LDAA	L0001		;Status word
	BMI	LCRK00		;Bra if motor is running
;
;-Engine off, load crank PW instead
;
	LDAA	LD215		;%TPS threshold for clear flood
	CMPA	L0043		;%TPS
	BHI	LCRK01		;Bra if TPS <=
;
	JMP	LD876		;Bra to cut the fuel
;
LCRK01	LDAA	L0020		;cool temp, inv, A/D counts
	COMA			;ones comp.
	LDX	#LCRKP00	;Crank PW table
	JSR	LD2D00		;16 bit 2D lookup
	LSLD			;x2
	BCC	LCRK02		;Bra if no overflow
;
	LDD	#$FFFF		;Clr overflow
;
LCRK02	STD	L00AE		;Sync BPW
	LDAA	L00AC		;crank PW baro correction factor
	JSR	LD73D		;Go add it to the BPW
	BRA	LCRK03		;Bra to continue
;
;-Engine running, use MAF 
;
LCRK00	LDD	L0018		;DRPs
	LDX	L00C7		;MAF flow, gms/sec x 16
	JSR	LMUL00		;(AB x X)/256
	STD	L00AE		;BPW
;
;-Inverse AFR lookup
;
	LDAA	L00A6		;AFR
	LDX	#LAFRINV	;AFRinv table addr
	JSR	LD2D00		;16 bit 2D lookup
	LDX	L00AE		;Load BPW
	JSR	LMUL00		;(AB x X)/256
	LSRD			;BPW/2
	STD	L00AE		;Save it, BPW
;
;-Multiply in the inj. const
;
	LDAA	L00A9		;Injector const., inv flowrate x 2048
	BSR	LD73D		;Bra to multiply it in
Reply
Old Nov 21, 2004 | 01:08 PM
  #22  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
All in all Id say it was a pain in the butt... and I still dont know if itll work yet. I origionally looked at the stuff in the ARAP and I was like "eh, I wont need all that. It looks like overkill, anyway..."

In reality thats like, the bare minimum really needed to make it work properly.
Reply
Old Nov 21, 2004 | 05:59 PM
  #23  
JPrevost's Avatar
Senior Member
 
Joined: Oct 1999
Posts: 6,621
Likes: 2
Car: 91 Red Sled
Axle/Gears: 10bolt Richmond 3.73 Torsen
cool stuff, just curious again, why the MAF? Why not SD with open loop and a wideband o2?
Reply
Old Nov 21, 2004 | 07:31 PM
  #24  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Eh, just to try it. All in all its probably jsut a different way of doing things. Once its dialed in Im going to run open loop and Im hoping that it might not be as sensitive to engine/timing changes as SD is. One theory that I had is that MAF might be better on tbi as its a wet flow system and the fuel vapors displace some of the air in the manifold, thereby causing a true SD system to only be an approximation as the calcs can be skewed. Pretty much just conjecture on my part, though.

Even if it doesnt work, Im not out any money, jsut time that I probably would have spend watching TV and drinking beer.

As contrary as it sounds, late model MAF sensors are dirt cheap. I guess since its not real flashy and shiny and doesnt say some fancy name on it then its not a performance part in some peoples eyes. I should start making 'performance' car parts. I could retire in five years. All I need is a flashy design and some misleading results.
Reply
Old Feb 5, 2005 | 04:10 PM
  #25  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Update:

I built the freq. voltage converter and Im going to wire it all up this weekend. The converter itself is just an LM2917 with some extra components to condition the input power and provide constant + 5 volts for the maf, all stuffed into a little box. Origionally I was also going to use a flip-flop to condition the maf input, as per haulinass' suggestion, to provide a 50% DC signal since the mafs is just a series of short pulses. While the flip-flop circuit itself worked, the MAF wouldnt trigger it. The signal probably didnt swing low enough. I took that out and just wired it directly to the 2917. Oddly enough, it seems to work just fine even while only being fed short pulses. The voltage output is right on the money so the frequency/voltage converter looks to be pretty accurate. I also made sure to use low tolerance capacitors with little temperature dependance where it mattered so it wouldnt be effected by the wildly fluctuating NJ weather.

The only thing left to do really is to make the TDF so I can use tunercats to tune it. After that, its the hard part of making all the tuning tweaks to get it to hopefully work.
Reply
Old Feb 5, 2005 | 06:23 PM
  #26  
JPrevost's Avatar
Senior Member
 
Joined: Oct 1999
Posts: 6,621
Likes: 2
Car: 91 Red Sled
Axle/Gears: 10bolt Richmond 3.73 Torsen
Sounds like progress . I'd like to see this actually work well for you.
Reply
Old Feb 7, 2005 | 10:33 PM
  #27  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
I took the car out tonight.

Good news:
Runs pretty good. Had to add around 10% more flow across the board before I could take it out. Seems like theres some bias in the converter.

One thing I noticed is that it runs much more evenly then the tbi-density, even without much tuning. The P/T driving is much better, and quieter. I have the muffler under the car and if the tune is off, the noise is ear splitting. I was really surprised with how well it ran for an untested system. I also tried some high throttle driving. Has good SOTP feel, but its probably a bit on the lean side. It really seems to point to the fact that the fuel dynamics of a wetflow system can really throw a SD type algorithm off.

Now for the bad news...

The car idles like ****. It sounds like its got a lumpy cam in it. The problem is wierd. The engine will start to idle down smoothly and then once it dips below 800 rpm it just craters. Its almost like theres an imaginary partition where on one side it runs good, on the other side it idles like poo. The blms also rocket to around 160+ when this happens. So far the problem looks to be a change in flow from turbulent to laminar. At idle the airflow is almost imperceptable when I put my hand in front of the MAF. I have a feeling that the air goes from turbulent to a laminar/turbulent transition region and the heat transfer coefficient of the airflow goes crazy. Im not quite sure how to get around this problem.

I havnt played with it much yet and I also just have the front of the MAF open to the ambient air. No air filter yet. I sure having the biggest MAF available doesnt help, either. Maybe putting a filter or some intake ducting ahead of it will help cure the problem. I sure hope it does.

Last edited by dimented24x7; Feb 7, 2005 at 10:49 PM.
Reply
Old Feb 8, 2005 | 07:26 AM
  #28  
BMmonteSS's Avatar
Supreme Member
 
Joined: Feb 2002
Posts: 2,663
Likes: 9
From: Buckhannon, WV
Car: 84' Monte
Engine: 350
Transmission: 700-r4
Axle/Gears: ferd 9" posi 3.50 gears
Kinda makes me think of a LS1 setup with their dual MAP and MAF setup, it would be neat to be able to switch over to one system or another for different driving conditions. Just use the MAP for idle and AE and the MAF for everything else.

Man I have to get into code, if I ever graduate I'll have the time.
Reply
Old Feb 8, 2005 | 11:11 AM
  #29  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
I was thinking of that. The MAP and RPM together have much better resolution then the MAF. Only problem is it would be really taxing memory and processor wise. I think I only have about 3 bytes of ram free so there wouldnt be much working room for any more algorithms.

Probably what Ill try is just slide filtering the hell out of the MAF at idle as well as getting the MAF table dialed in. Im not shooting for perfect at idle, but right now it barely idles at all.
Reply
Old Feb 8, 2005 | 11:17 AM
  #30  
RednGold86Z's Avatar
Supreme Member
20 Year Member
iTrader: (1)
 
Joined: Mar 2000
Posts: 1,692
Likes: 1
From: Corona
Car: 92 Form, 91 Z28, 89 GTA, 86 Z28
Engine: BP383 vortech, BP383, 5.7 TPI, LG4
Transmission: 4L60e, 700R4, 700R4..
Axle/Gears: 3.27, 2.73
MAF's are very VERY sensitive to what's in front of them. I would suggust at least 6 inches of straight pipe in front of one. You could stick whatever you have lying around on there to see if that's the cause of the idle poo (cardboard and duct tape?).
Reply
Old Feb 8, 2005 | 11:47 AM
  #31  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Thanks, Ill give that a shot. Dont have much room for ductwork and a filter, though. The MAF would have to sit further back over the headers, and baking the MAF over 600 degree metal pipes could have less then desirable effects.
Reply
Old Feb 8, 2005 | 10:20 PM
  #32  
dimented24x7's Avatar
Thread Starter
Supreme Member
iTrader: (2)
 
Joined: Jan 2002
Posts: 9,962
Likes: 5
From: Moorestown, NJ
Car: 88 Camaro SC
Engine: SFI'd 350
Transmission: TKO 500
Axle/Gears: 9-bolt w/ 3.23's
Looks like it might just be a calibration problem. I cranked up the maf table at low flow rates and it helped to stablize and unstinkify the idle. Its funny that before it had an eye watering idle even though it looks like it was just lean. Mustve had a lean misfire or something dumping parially unburned fuel into the exaust.
Reply




All times are GMT -5. The time now is 01:11 PM.