C4 Tech/Performance L98 Corvette and LT1 Corvette Technical Info, Internal Engine, External Engine

How a 3d Table works

Thread Tools
 
Search this Thread
 
Old 04-26-2003, 06:05 PM
  #1  
WishIownedOne
Heel & Toe
Thread Starter
 
WishIownedOne's Avatar
 
Member Since: Apr 2003
Location: Suagus Ca
Posts: 16
Likes: 0
Received 0 Likes on 0 Posts
Default How a 3d Table works

I am getting a lot of email about this, so I will just make a couple of big posts.

This first part is the assembly code, the second part will be an explantion.
The third part will be pictures for those who do not care to learn code.

<BLOCKQUOTE>code:<HR><PRE>


ORG $886B
;----------------------------------------------
; MAIN FUEL TABLE vs MAP vs RPM
;
;
; TBL = %VE * 2.56
;----------------------------------------------

886B 00 FCB 0 ; Min RPM Val
886C 00 FCB 0 ; Min MAP Value
886D 11 FCB 17 ; COL'S/ROW
;--------------------------------------------------
; 0 RPM
;
; %VE Kpa MAP
;--------------------------------------------------
886E 01 FCB 1 ; 64.1 20.0
886F 02 FCB 2 ; 68.8 25.0
8870 03 FCB 3 ; 71.1 30.0
8871 04 FCB 4 ; 73.4 35.0
8872 05 FCB 5 ; 75.0 40.0
8873 06 FCB 6 ; 76.2 45.0
8874 07 FCB 7 ; 77.0 50.0
8875 08 FCB 8 ; 78.1 55.0
8876 09 FCB 9 ; 78.9 60.0
8877 0A FCB 10 ; 79.3 65.0
8878 0B FCB 11 ; 79.7 70.0
8879 0C FCB 12 ; 79.7 75.0
887A 0D FCB 13 ; 80.1 80.0
887B 0E FCB 14 ; 80.5 85.0
887C 0F FCB 15 ; 80.9 90.0
887D 10 FCB 16 ; 81.6 95.0
887E 11 FCB 17 ; 82.8 100.0

;--------------------------------------------------
; 400 RPM
;
; %VE Kpa MAP
;--------------------------------------------------
887F 01 FCB 1 ; 64.1 20.0
8880 02 FCB 2 ; 68.8 25.0
8881 03 FCB 3 ; 71.1 30.0
8882 04 FCB 4 ; 73.4 35.0
8883 05 FCB 5 ; 75.0 40.0
8884 06 FCB 6 ; 76.2 45.0
8885 07 FCB 7 ; 77.0 50.0
8886 08 FCB 8 ; 78.1 55.0
8887 09 FCB 9 ; 78.9 60.0
8888 0A FCB 10 ; 79.3 65.0
8889 0B FCB 11 ; 79.7 70.0
888A 0C FCB 12 ; 79.7 75.0
888B 0D FCB 13 ; 80.1 80.0
888C 0E FCB 14 ; 80.5 85.0
888D 0F FCB 15 ; 80.9 90.0
888E 10 FCB 16 ; 81.6 95.0
888F 11 FCB 17 ; 82.8 100.0

;--------------------------------------------------
; 800 RPM
;
; %VE Kpa MAP
;--------------------------------------------------
8890 01 FCB 1 ; 64.1 20.0
8891 02 FCB 2 ; 68.8 25.0
8892 03 FCB 3 ; 71.1 30.0
8893 04 FCB 4 ; 73.4 35.0
8894 05 FCB 5 ; 75.0 40.0
8895 06 FCB 6 ; 76.2 45.0
8896 07 FCB 7 ; 77.0 50.0
8897 08 FCB 8 ; 78.1 55.0
8898 09 FCB 9 ; 78.9 60.0
8899 0A FCB 10 ; 79.3 65.0
889A 0B FCB 11 ; 79.7 70.0
889B 0C FCB 12 ; 79.7 75.0
889C 0D FCB 13 ; 80.1 80.0
889D 0E FCB 14 ; 80.5 85.0
889E 0F FCB 15 ; 80.9 90.0
889F 10 FCB 16 ; 81.6 95.0
88A0 11 FCB 17 ; 82.8 100.0

;--------------------------------------------------
; 1200 RPM
;
; %VE Kpa MAP
;--------------------------------------------------
88A1 01 FCB 1 ; 64.1 20.0
88A2 02 FCB 2 ; 68.8 25.0
88A3 03 FCB 3 ; 71.1 30.0
88A4 04 FCB 4 ; 73.4 35.0
88A5 05 FCB 5 ; 75.0 40.0
88A6 06 FCB 6 ; 76.2 45.0
88A7 07 FCB 7 ; 77.0 50.0
88A8 08 FCB 8 ; 78.1 55.0
88A9 09 FCB 9 ; 78.9 60.0
88AA 0A FCB 10 ; 79.3 65.0
88AB 0B FCB 11 ; 79.7 70.0
88AC 0C FCB 12 ; 79.7 75.0
88AD 0D FCB 13 ; 80.1 80.0
88AE 0E FCB 14 ; 80.5 85.0
88AF 0F FCB 15 ; 80.9 90.0
88B0 10 FCB 16 ; 81.6 95.0
88B1 11 FCB 17 ; 82.8 100.0

;--------------------------------------------------
; 1600 RPM
;
; %VE Kpa MAP
;--------------------------------------------------
88B2 01 FCB 1 ; 64.1 20.0
88B3 02 FCB 2 ; 68.8 25.0
88B4 03 FCB 3 ; 71.1 30.0
88B5 04 FCB 4 ; 73.4 35.0
88B6 05 FCB 5 ; 75.0 40.0
88B7 06 FCB 6 ; 76.2 45.0
88B8 07 FCB 7 ; 77.0 50.0
88B9 08 FCB 8 ; 78.1 55.0
88BA 09 FCB 9 ; 78.9 60.0
88BB 0A FCB 10 ; 79.3 65.0
88BC 0B FCB 11 ; 79.7 70.0
88BD 0C FCB 12 ; 79.7 75.0
88BE 0D FCB 13 ; 80.1 80.0
88BF 0E FCB 14 ; 80.5 85.0
88C0 0F FCB 15 ; 80.9 90.0
88C1 10 FCB 16 ; 81.6 95.0
88C2 11 FCB 17 ; 82.8 100.0

;------------------------------------------------------------------
;
; STEP 1 PROCESS TABLE HEADER INFO FOR MINIMUM VALUES TO USE
;
;------------------------------------------------------------------

ORG $EC25
PSHY
PSHB
PSHX
SUBA 0,X ; SUBTRACT MIN RPM ENTRY VALUE
BCC $EC2E
; ... else
CLRA
SUBB 1,X ; SUBTRACT MIN MAP ENTRY VALUE
BCC $EC33
; ... else
CLRB
PSHX ; MOVE TABLE HEADER LOCATION TO STACK
PULY ; TRANSFER TABLE HEADER LOCATION TO Y REG
PSHA ; PUSH RPM TO STACK

;-----------------------------------------------------------------
;
; STEP 2 FIND COLUMN LOCATION
;
;-----------------------------------------------------------------

;------------------------------------------
; MAP ARG COLUMN OFFSET (VALX16/256 = BYTE OFFSET) 0-16 BYTES
;------------------------------------------
LDAA #16 ; DEFINES THIS AS A 16 BIT TABLE
MUL ; MAP VALUE X 16 (N X 16 (AB= XX.XX)
; (16 BIT RESOLUTION REG B FOR RESULT IN REG A)
PSHB ; PUSH MAP VECTOR FRACTION TO STACK (REG B .XX)

TAB ; MOVE COLUMN OFFSET TO B
ABX ; ADD REG B COLUMN OFFSET TO TABLE BASE LOCATION
; (0-15 BYTE STEPS)

PULB ; GET BACK MAP VECTOR FRACTION
PULA ; GET BACK RPM VALUE FOR USE IN STEP 3
PSHB ; PUT MAP VECTOR FRACTION BACK ON STACK (FOR INTERPOLATION)

;----------------------------------------------------------------
;
; STEP 3 FIND LOWER ROW LOCATION
;
;---------------------------------------------------------------
;-----------------------------------------
; RPM ARG LOWER ROW OFFSET (VALX16/256) X 17 = ROW BYTE OFFSET) 0-255 BYTES
; ROWS ARE 4 BYTES BELOW ACTUAL POINT (OFFSET ADDED WITH A 3,X LOAD FOR UPPER/LOWER VALUES)
;-----------------------------------------
LDAB #16 ; DEFINES THIS AS A 16 BIT TABLE
MUL ; RPM X16 (N X 16 (AB= XX.XX)
; (16 BIT RESOLUTION REG B FOR RESULT IN REG A)
PSHB ; PUSH RPM VECTOR FRACTION TO STACK (.XX)
; (0-15 BYTE STEPS)


LDAB 2,Y ; GET COLUMNS PER ROW 17
MUL ; RPM OFFSET (BYTE STEPS X 17)
; (17 BITS INCREASE RESULT IN B REG PER BIT IN REG A)

ABX ; ADD REG B OFFSET TO X (MAP COL OFFSET + RPM ROW OFFSET) = LOWER ROW X COL Y
; (0-255 BYTE STEPS)

PSHX ; SAVE FIRST ROW COORDINATE TO STACK

;----------------------------------------------------------------
;
; STEP 4 FIND UPPER ROW LOCATION FROM TABLE HEADER ROW/COL VALUE
;
;----------------------------------------------------------------


;----------------------------------------------
; MAKE UPPER ROW LOCATION
; ROWS ARE 4 BYTES BELOW ACTUAL POINT (OFFSET ADDED WITH A 3,X LOAD FOR UPPER/LOWER VALUES)
;----------------------------------------------

LDAB 2,Y ; GET COLUMNS PER ROW 17
ABX ; ADD IT TO REG X (BASE REG+MAP OFFSET) POINTS TO UPPER ROW X COL Y
TSY ; PUT STACK LOCATION IN Y


;----------------------------------------------------------------
;
; STEP 5 GET UPPER TABLE ROW COLUMN VALUES (2 BYTES)
;
;----------------------------------------------------------------

;-----------------------------------------------
; UPPER ROW COLUMN VALUES FIND
; NO INTERPOLATION IS DONE IF VECTOR FRACTION = 0
;-----------------------------------------------
LDD 3,X ; (LOAD W/4BYTE OFFSET FOR UPPER BYTE) GET UPPER ROW COLUMN VALUES (TWO BYTES)
SBA ; SUBTRACT UPPER COLUMN VALUE FROM LOWER
LDAB 3,Y ; GET MAP VECTOR FRACTION (.XX) (INTEPOLATION DELTA)
BCC $EC5E ; BRANCH IF UPPER COLUMN VAL WAS EQUAL OR LESS THAN LOWER (NO CARRY)


;-------------------------------
; TABLE COLUMN VALUES INCREASING
;-------------------------------
NEGA ; INVERT THE NEGATIVE VALUE
MUL ; INTERP FOR TABLE COLUMN VALUES INCREASING (* MAP DELTA)
ADCA 3,X ; ADD WITH ROUND UPPER ROW, LOWER COLUMN VALUE (FINAL UPPER RESULT)
BRA $EC64 ; DONE, GO TO SAVE UPPER ROW FINAL VALUE

;-------------------------------
; TABLE COLUMN VALUES DECREASING
;-------------------------------
MUL ; INTERP FOR TABLE COLUMN VALUES DECREASING (* MAP DELTA)
ADCA #$0000 ; ROUND
NEGA
ADDA 3,X ; ADD UPPER ROW, LOWER COLUMN VALUE (FINAL UPPER RESULT)
PULX ; GET LOWER ROW TABLE COORDINATE

PSHA ; SAVE UPPER ROW FINAL VALUE


;------------------------------------------------------------------
;
; STEP 6 GET LOWER TABLE ROW COLUMN VALUES (2 BYTES)
;
;------------------------------------------------------------------

;-----------------------------------------------------
; LOWER ROW COLUMN VALUES FIND
; NO INTERPOLATION IS DONE IF VECTOR FRACTION = 0
;-----------------------------------------------------

LDD 3,X ; (LOAD W/4BYTE OFFSET FOR UPPER BYTE) GET LOWER ROW COL VALUES (TWO BYTES)
SBA ; SUBTRACT UPPER COLUMN VALUE FROM LOWER
LDAB 3,Y ; GET MAP VECTOR FRACTION (.XX) (INTERPOLATION DELTA)
BCC $EC74 ; BR IF UPPER COLUMN VAL WAS EQUAL OR LESS THAN LOWER (NO CARRY)

;-------------------------------
; TABLE COLUMN VALUES INCREASING
;-------------------------------

NEGA ; INVERT THE NEGATIVE VALUE
MUL ; INTERP FOR TABLE COL VALUES INCREASING (* MAP DELTA)
ADCA 3,X ; ADD WITH ROUND LOWER ROW, LOWER COLUMN VALUE (FINAL LOWER RESULT)
BRA $EC7A


;-------------------------------
; TABLE COLUMN VALUES DECREASING
;-------------------------------

MUL ; INTERP FOR TABLE COL VALUES DECREASING (* MAP DELTA)
ADCA #$00 ; ROUND
NEGA
ADDA 3,X ; ADD LOWER ROW, LOWER COLUMN VALUE (FINAL LOWER RESULT)

;-----------------------------------------------------------------
;
; STEP 7 INTERPOLATE UPPER AND LOWER ROW VALUES
;
;-----------------------------------------------------------------

;----------------------------------------------------
; INTERPOLATE UPPER AND LOWER ROW VALUES WITH RPM VECTOR FRACTION
; NO INTERPOLATION IS DONE IF VECTOR FRACTION = 0
;----------------------------------------------------

PULB ; GET BACK UPPER ROW FINAL INTERPOLATED VALUE
PSHA ; SAVE LOWER ROW INTERPOLATED VALUE TO STACK
SBA ; SUBTRACT UPPER ROW FROM LOWER ROW VALUE
LDAB 2,Y ; GET BACK RPM VECTOR FRACTION FROM STACK (INTERPOLATION DELTA)
BCC $EC89 ; BR IF UPPER ROW VAL WAS EQUAL OR LESS THAN LOWER ROW (NO CARRY)

;-------------------------------
; TABLE ROW VALUES INCREASING
;-------------------------------


NEGA ; INVERT THE VALUE
MUL ; INTERP FOR TABLE ROW VALUES INCREASING (* RPM DELTA)
ADCA 1,Y ; ADD BACK LOWER VALUE (FINAL TABLE RESULT)
BRA $EC90

;-------------------------------
; TABLE ROW VALUES DECREASING
;-------------------------------

MUL ; INTERP FOR TABLE ROW VALUES DECREASING (* RPM DELTA)
ADCA #$00 ; ROUND
NEGA
ADDA 1,Y ; ADD BACK LOWER ROW VALUE (FINAL TABLE RESULT)
; DONE, RESULT IN REGISTER A

</PRE>[/QUOTE]
Old 04-26-2003, 06:07 PM
  #2  
WishIownedOne
Heel & Toe
Thread Starter
 
WishIownedOne's Avatar
 
Member Since: Apr 2003
Location: Suagus Ca
Posts: 16
Likes: 0
Received 0 Likes on 0 Posts
Default Re: How a 3d Table works (WishIownedOne)

Let's walk through the code.
This is in reference to the code posted above.
The VE values are not to scale. They are numbered from 1-17
to show you the table lines, not the actual VE value.

;----------------------------------------------
; MAIN FUEL TABLE vs MAP vs RPM
;
;
; TBL = %VE * 2.56
;----------------------------------------------
$ORG $ 886B ; Table starting address
FCB 0 ; Min RPM Val
FCB 0 ; Min MAP Value
FCB 17 ; COL'S Per ROW


You can have the map as the rows and rpm as the columns. For this demonstration,
Rpm is the row, and Map is the column.

RPM Input = RPM/25
MAP Input = (((MAP A/D value -26) x151) x2) /256

The table routine is based on the starting address of where it is in the file
and ascends from there to find the appropriate values. If the table starts at a hexadecimal
location of $886B, the two input values will be multiplied by how many bits it takes to get to the
next step up, then added to the base table location. The table rows/column values are to
be considered the "center" points.


Example:

If the table is 16 bit resolution, the input value (Map or Rpm) must increase by 16
bits to get to the next row. This is where we get the table resolution.

The map value input range is 20-100 KPA. Thats an 80 KPA range. 80 KPA/16 bits is
5 KPA per step.

The Rpm value input range is 0-6400 RPM. That's a 6400 RPM range. 6400/16 bits is
400 RPM per step.

Every 3D table has a header to tell us how big it is going to be.
The minimum Map value is an offset to get us to the next column. So until
the Rpm or Map value is equal or higher than the input value, it will be cleared to zero.
The columns per row is based on the minimum entry values. 17 is for a 16 bit table with
a range of 0-255 bits. 256 bit input/16 resolution = 16 lines. The 17 comes from a LDD
operation which is 2 bytes.
128 bit input / 16 bit resolution = 8 lines (LDD = 9 LINES)
By changing the input range value and table resolution value, you can determine
what size your table will be.


Algo:

STEP 1:
Here we determine how large the table will be from the example given above.

STEP 2 Find the MAP column:
Now we take the input Map value and multiply it by 16 to get the column
offset to add to the base table location. Any fractional remainder from this will
be used to interplolate the result if it lands between two columns.

A MAP value of 40 KPA = input value of 65 decimal
65 x 16 bit/256 = 4.0625
CPU register A will have the 4 <--used for table offset
CPU register B will have the .0625 <--used to interpolate results

Add the 4 to the table base $886B = $886F
That puts us at Row 1, Column 2
0 Rpm, 25 KPA

Save the fraction .062 for later.

STEP 3 Find the RPM Row location:
Now we take the input Rpm value and multiply it by 16 to get row
offset. Any fractional remainder from this will be used to interpolate the result
if it lands between two rows.

An Rpm value of 1250 = an input value of 50
50 x 16 bit/256 = 3.125
CPU register A will have the 3 <--used for table offset
CPU register B will habe the .125 <--used to interpolate resluts

Save any fractional remainder to interpolate the rows later.
Now we take the Row per Column value in the table header to find our row
location

Rpm byte offset 3 x table rows 17 = 51
Add the 51 to the table base $886F = $88A2
That puts us at Row 4, Column 2
1200 Rpm,25 KPA

This is now your lower Row, Column table Locataion.

STEP 4 Find upper Row, Column Location:
Here we just add the Row per Column value from step 3

17 + $88A2 = $88B3

That puts us at Row 5, Column 2
1600 Rpm,25 KPA

STEP 5 Get upper table values and interpolate:
The LDD 3,X operation tells the CPU to load registers
A,B with the values 4 bytes higher than the current table location.
Register A will be 3 bytes higher, Register B will be 4 bytes higher.
$88B3. That puts us at $88B6 and $88B7
$88B6= Row 5, Column 5 (1600 Rpm, 40 KPA)
$88B7= Row 5, Column 6 (1600 RPm, 45 KPA)

Interploation between these two values is
(((Difference between values) x vector fraction) + lower value) Rounded

Example:
Upper VE value= 60, lower VE value = 50, vector fraction =.062

60-50= -10
invert -10 =10
10 x .062
.062 + 50 = 50.062
Rounded = 51
Final value = 51


STEP 6 Get Lower table values and interpolate
Same as step 5 except our offset table address points
to $88A2
$88A5 = Row 4, Column 5 (1200 Rpm, 40 KPA)
$88A6 = Row 4, Column 6 (1200 Rpm, 45 KPA)


STEP 7 Interpolate the Upper and Lower table values

Just use the interpolation example from above, but use
the Rpm vector fraction.

Done, you now have your final result.


The math is the same for a 2D table but only done once, and there
is no table header.


[Modified by WishIownedOne, 11:13 PM 4/26/2003]


[Modified by WishIownedOne, 11:21 PM 4/26/2003]


[Modified by WishIownedOne, 11:32 PM 4/26/2003]


[Modified by WishIownedOne, 11:48 PM 4/26/2003]


[Modified by WishIownedOne, 11:54 PM 4/26/2003]


[Modified by WishIownedOne, 11:57 PM 4/26/2003]
Old 04-26-2003, 06:11 PM
  #3  
WishIownedOne
Heel & Toe
Thread Starter
 
WishIownedOne's Avatar
 
Member Since: Apr 2003
Location: Suagus Ca
Posts: 16
Likes: 0
Received 0 Likes on 0 Posts
Default Re: How a 3d Table works (WishIownedOne)

With pretty pictures.

http://24.130.98.97:8080/3dtable.htm


If I have any typo's I will correct them later.
But don't hesitate to let me know.

Thanks
Ken Cannata
Old 04-26-2003, 07:54 PM
  #4  
HighHopes85
Drifting
 
HighHopes85's Avatar
 
Member Since: Mar 2001
Location: Lafayette IN
Posts: 1,636
Likes: 0
Received 3 Likes on 3 Posts

Default Re: How a 3d Table works (WishIownedOne)

Ken-Thanks! Questions sure to follow once it seems to sink in :D
Old 04-26-2003, 08:02 PM
  #5  
GlockLT4
Team Owner
 
GlockLT4's Avatar
 
Member Since: Apr 2001
Location: Dallas TX
Posts: 22,267
Likes: 0
Received 3 Likes on 3 Posts

Default Re: How a 3d Table works (HighHopes85)

:cool: :thumbs: Same here, i'm sure i'll have some questions once i start programming my car again and think more carefully about all of that :cheers:
Old 04-26-2003, 10:35 PM
  #6  
DOCTOR J
Burning Brakes
 
DOCTOR J's Avatar
 
Member Since: May 1999
Location: Greenwich, CT
Posts: 760
Likes: 0
Received 0 Likes on 0 Posts

Default Re: How a 3d Table works (WishIownedOne)

Hi, Ken & welcome to the board.

That's an excellent explanation, thank you. I struggle greatly trying to read assembly code, and appreciate all the help I can find.

Now, I have a Q if you don't mind. I understand your example of 0-16 rows with 16 bits between each row (16 X 16 = 256). But:

In the 727 ECM code, GM set up the main lower VE table (for example) as 0-12 rows & 0-12 columns. The hack I have doesn't show a bit-resolution for that table, and I can't quite work out why there are 13 entries. I can understand 8-bit or 16-bit resolution, but why 12?

Does the code truncate 16 bits down to 12? Or does that imply like 20-bit resolution between the table steps? (20 X 12 = not quite 256???) I'm confused & thank you in advance for any light you can shed!

Regards
DrJ
Old 04-27-2003, 02:57 PM
  #7  
WishIownedOne
Heel & Toe
Thread Starter
 
WishIownedOne's Avatar
 
Member Since: Apr 2003
Location: Suagus Ca
Posts: 16
Likes: 0
Received 0 Likes on 0 Posts
Default Re: How a 3d Table works (DOCTOR J)

I was hoping somebody would ask this :)
This is the most confusing part, but worth understanding it.

On some ECM's the 3D routine is shared. Others it's not.

The offset is done before the 3D routine when it's shared.
Remember the 3D table is 1 change to the table base Address offset for every 16 bits input.
The example I gave was for input values ranging from 0-255 bits.
When you rescale your input values, things change.
I'll try and explain some scaling techniques.


On the 3D routine:
<BLOCKQUOTE>code:<HR><PRE>
;------------------------------------------
; ROW OR COLUMN OFFSET (VALX16/256 = BYTE OFFSET) 0-16 BYTES
;------------------------------------------
LDAA #16 ; DEFINES THIS AS A 16 BIT TABLE
MUL ; MAP VALUE X 16 (N X 16 (AB= XX.XX)
; (16 BIT RESOLUTION REG B FOR RESULT IN REG A)
</PRE>[/QUOTE]


The LDAA #16 defines this as a table that works in multiples of 16.
For every 16 bit increase of your input value, register A will have another
whole number added to it.

16 x 16/256 = 1 16 x 32/256 = 2 , etc

Change LDAA #16 to 8 and you have multiples of 32 bits.
Change LDAA #16 to 32 and you have multiples of 8 bits. (you will have to modify the routine
to use register D to handle the larger than 255 result).

You can also have 2 different resolutions for the Rows or Columns.

All of that was based on input values that ranged from 0-255
RPM Input = RPM/25 (0-6375 Rpm)
MAP Input = (((MAP A/D value -26) x151) x2) /256 (20-100 KPA)


Now on to the ANHT input scaling.
I'll just use the RPM scaling for the 400-1600 Rpm table.
The idea is the same for the rest.


<BLOCKQUOTE>code:<HR><PRE>
**************************************** ***********
* LK UP VE FROM MAP & RPM
* USING VE1 or VE2 TABLES
* ANHT, TYPE $8D ECM
**************************************** ************


LDAB $0071 ; NORMILIZED LOAD MAP VAL
LDAA $0085 ; RPM/25
CMPA #64 ; 1600 RPM ?
BCS $CBF7 ; BR if LT 1600 RPM (RPM/25 = 63 OR LESS)

;------------------------
; LK UP VE vs RPM vs MAP
; (FOR RPM GT 1600)
;------------------------
LDX #$8797 ; VE TABLE FOR GT 1600 RPM
SUBA #$64 ; SUB OFF 166 RPM OFFSET
LSRB
CMPA #160 ; CK IF 1600 RPM
BLS $CC08 ; BR If less
LDAA #160 ; Else limit to 1600 RPM
BRA $CC08 ; TO LOOK UP ROUTINE
;---------------------------------
; LO RPM TABLE 0-1575 RPM
;---------------------------------
$CBF7 LDX #$86EB ; VE TABLE FOR RPM LT 1600 RPM
SUBA #16 ; SUB OFF 400 RPM OFFSET
BCC $CBFF ;
; ... else
CLRA ; CLEAR RPM IF UNDER 400
ASLA ; MULTIPLY RPM X 2
ASLA ; MULTIPLY RPM X 2
CMPB #128 ; CK IF MAP LT EQ 60 Kpa
BLS $CC08 ; IF LT, GO TO LOOK UP
; ... else
LSRB ; Rescale for 10 Kpa/ Break point (DIVIDE BY 2)
ADDB #64
$CC08 JSR $E353
</PRE>[/QUOTE]

INPUT VALUE:
For the Low Rpm table the input range is changed from 0-255 to 0-188 bits.
Minimum Rpm 400 = 0, maximum Rpm 1575 = 63
Multiplied x 4 = 0-188 for an input value to the 3D table.
So take your 0-1575 Rpm range, subtract the offset of 400 rpm,
that gives you 1175 Rpm. 1175/188 max, is an input value of 6.25
Our new Rpm range is 6.25Rpm Bit


TABLE VALUES:
Seeing as we subtracted 400 rpm from out input value, our
range is now 1600-400 = 1200 Rpm

Take the scaled maximum input value of 188, divide by our 3D table 16 bit
input resolution and you have 11.75 (12 rows rounded)

1200 Rpm/12 = 100 That's 100 rpm per row now.

If you remember our old scaling was Rpm/25 (25 rpm per bit) for the 16 bit
table scaling.
25 x 16 =400, 50 x 16 = 800, 75 x 16 = 1200 (etc)

Our new scaling is Rpm/6.25 (6.25 rpm per bit) for the 16 bit
table scaling.
6.25 x 16 = 100, 12.5 x 16 = 200, 18.75 x 16 = 300 (etc)
Remember we dumped off 400 Rpm, so the table has a 400
Rpm offset.

It know gets a little confusing if you try and compare the original rpm input
to the scaled table input.

But just think of it this way. Originally we had to move 16 bits of Rpm/25 to get to
the next row or column center. That was 400 Rpm (25 x 16 = 400)

Scaled, it only takes 4 bits of Rpm/25 to get to the next table center.
25/4= 6.25 That's 100 Rpm (6.25 x 16 = 100)

Also our table has been offset by 400 Rpm. That means the first center of Row 2
has to be 20 bits of Rpm/25
Rpm/25 x 20 = 500

The offset is:
500 Rpm/25 = 20
400 Rpm/25 = 16
20 - 16 = 4
4 x 2 x 2 = 16

16 Bits on our 3D table input gives us one location change.
(16 x 16 / 256= 1) or (16/16 = 1)
1 is our first whole number in register A to change the table location base

Now that you people are armed with this information, you can change your table
resolutions if you don't like them. Say somebody wanted better resolution
of the Map scaling on the second ANHT VE table.


<BLOCKQUOTE>code:<HR><PRE>
;------------------------
; LK UP VE vs RPM vs MAP
; (FOR RPM GT 1600)
;------------------------
LDX #$8797 ; VE TABLE FOR GT 1600 RPM <<-----
SUBA #$64 ; SUB OFF 166 RPM OFFSET
LSRB ; DIVIDE MAP RANGE BY 2 <<<-------
CMPA #160 ; CK IF 1600 RPM
BLS $CC08 ; BR If less
LDAA #160 ; Else limit to 1600 RPM
BRA $CC08 ; TO LOOK UP ROUTINE

</PRE>[/QUOTE]

If you look where the second arrow is above, that is where the Map resolution
is turned into 10 KPA per Column. (0-128)
128/16 = 8
100-20 = 80 Kpa
Map range of 80 Kpa/8 = 10 Kpa per Column


Let's say somebody was to change to LSRB to NOP. You now have the full
resolution of 5Kpa per Row.
256/16 = 16
100-20 = 80 Kpa
Map range of 80 Kpa/16 = 5 Kpa per Column.


Now your table is going to be bigger and won't fit in the original location.
Assuming you have enough room in you Eprom, you can move the entire table someplace
else.

If you move the table someplace else, change the LDX #$8797 to the value of where your new
table starts. Don't forget to include the table header and change the Column Per Rows
value to 17 instead of 9.

Make the changes in your Tunercat TDF file to address the new location, enter your VE values,
make a good guess on the new values that fall between the old ones and your set!

Hope that helps,

Ken Cannata


Old 04-27-2003, 03:31 PM
  #8  
DOCTOR J
Burning Brakes
 
DOCTOR J's Avatar
 
Member Since: May 1999
Location: Greenwich, CT
Posts: 760
Likes: 0
Received 0 Likes on 0 Posts

Default Re: How a 3d Table works (Ken)


Ken, that's terrific, thanks a lot! Been trying to figger that out for quite a while. Looks like it's time to buy the TDF editor...

Hope you don't mind more Q's as I stumble through this, and thanks again.

DrJ
Old 05-05-2003, 01:17 PM
  #9  
HighHopes85
Drifting
 
HighHopes85's Avatar
 
Member Since: Mar 2001
Location: Lafayette IN
Posts: 1,636
Likes: 0
Received 3 Likes on 3 Posts

Default Re: How a 3d Table works (WishIownedOne)

Hey Ken-You have any bookmarks of the acronyms? Wanna read up before I start asking elementary stuff. TIA, -Matt
Old 05-05-2003, 07:19 PM
  #10  
WishIownedOne
Heel & Toe
Thread Starter
 
WishIownedOne's Avatar
 
Member Since: Apr 2003
Location: Suagus Ca
Posts: 16
Likes: 0
Received 0 Likes on 0 Posts
Default Re: How a 3d Table works (HighHopes85)

Hey Ken-You have any bookmarks of the acronyms? Wanna read up before I start asking elementary stuff. TIA, -Matt
Acronyms?
Are you talking about the instruction set Nmemonics (LDAA,CMPA,etc).
Old 05-06-2003, 01:49 AM
  #11  
HighHopes85
Drifting
 
HighHopes85's Avatar
 
Member Since: Mar 2001
Location: Lafayette IN
Posts: 1,636
Likes: 0
Received 3 Likes on 3 Posts

Default Re: How a 3d Table works (WishIownedOne)

Exactly. Most of your comments are great...I'm getting stuck on the easy ones.

i.e.

FDB
FCD

Looks like in the following from the ANHT hack, FCD represents an 8 bit and FDB is a 16 bit...

<BLOCKQUOTE>code:<HR><PRE>
L802A: FCB 24 ; 300 RPM, IF RPM < ENABLE STALL SAVER SA
L802B: FCB 24 ; 300 RPM, IF RPM < & RPM > L802C,
; ENABLE STALL SAVER SA
L802C: FCB 44 ; 550 RPM, IF RPM > & RPM < L802B,
; ENABLE STALL SAVER SA
L802D: FCB 24 ; 300 RPM, IF RPM > DISABLE STALL SAVER SA
L802E FCB 16 ; 16 BIN ADDED TO SA BLEND EACH DRP
</PRE>[/QUOTE]

Does L802B and L802C just loop the stall saving routine and stop once 550 RPM has been reached? And when the heck did RPM start getting divided by 12.5 instead of 25? I was under the impression that RPM routines always got dvided by 25, but for the "FCB = 24, therefore RPM is 300" 300/24 = 12.5

I'm not even past page 3 of the hack. LOL

I guess another way of wording it from your example is how do I find the "TBL = %VE * 2.56" portion (using your example) but for each table.


[Modified by HighHopes85, 1:03 AM 5/6/2003]
Old 05-06-2003, 09:46 AM
  #12  
WishIownedOne
Heel & Toe
Thread Starter
 
WishIownedOne's Avatar
 
Member Since: Apr 2003
Location: Suagus Ca
Posts: 16
Likes: 0
Received 0 Likes on 0 Posts
Default Re: How a 3d Table works (HighHopes85)

Actually those mean something to the assembler. All of the so called "hacks"
are written as an assembly file. If you use notepad and rename the file to
.asm instead of .txt you can re-assemble the file into code. Copy everything
from the PDF to notepad.

Take a look at this: http://www.owlnet.rice.edu/~elec201/Book/6811_asm.html

L802A: FCB 24 ; 300 RPM, IF RPM


The L802A is the address in hex of where this data is. It is not an instruction.
802A can be proceeded by an L, or $ it depends on the assembler.
L802A or $802A is the same thing.

FCB means Form Constant Byte (8bit)

; is for your notes. Anything after this will be ignored the assembler.

"TBL = %VE * 2.56"
This is what the values of the bytes/words to the algorithm when it gets
used. I can explain a little more later.

Gotta run,

Ken

Old 05-06-2003, 12:40 PM
  #13  
HighHopes85
Drifting
 
HighHopes85's Avatar
 
Member Since: Mar 2001
Location: Lafayette IN
Posts: 1,636
Likes: 0
Received 3 Likes on 3 Posts

Default Re: How a 3d Table works (WishIownedOne)

Ok, here's my shot at it...

<BLOCKQUOTE>code:<HR><PRE>
;------------------------------
; STALL SAVER
; ARG = N * 12.5
;------------------------------
L802A: FCB 24 ; 300 RPM, IF RPM < ENABLE STALL SAVER SA

[At location $802A on the EPROM, the an 8 bit value and is stored as HEX on
the chip as 18(h). 24 * 12.5 gives us 300(d) and this is the value that we
understand. So if RPM < 300, then enable stall saver).


L802B: FCB 24 ; 300 RPM, IF RPM < & RPM > L802C, ; ENABLE STALL SAVER SA

[Same as above, but different a different address is used...now reads if
Engine RPM is < 300 AND Engine RPM is > 550 (which comes from valve 44
at $802C * 12.5) then Enable stall saver SA]. The problem is, this seems like
a redundant routine...if you are under 300 RPM, you will never be over 550
RPM.

L802C: FCB 44 ; 550 RPM, IF RPM > & RPM < L802B, ; ENABLE STALL SAVER SA

[$802C stores the 44(d) value in HEX as 2C(h). 44 * 12.5 = 550. It says "If
RPM is greater than 550 and RPM is less than 300, enable stall saver SA]
Same thing here goes...the routine appears to be redundant.

L802D: FCB 24 ; 300 RPM, IF RPM > DISABLE STALL SAVER SA

[If RPM is greater than 300 RPM, Disable stall saver SA]

L802E FCB 16 ; 16 BIN ADDED TO SA BLEND EACH DRP

[???This tells just how much spark advance needs to be added on each
distributor reference pulse when you are in stall saver mode??? I think the
comment of BIN in this line is messing me up]
</PRE>[/QUOTE]

Looks like things are starting to form together. Maybe we could start a general post about this stuff so it doesn't clutter up your explanation of tables??? I don't want to come across as hijacking a good thread. :thumbs: -Matt

Edited for width


[Modified by HighHopes85, 11:41 AM 5/6/2003]
Old 05-10-2003, 05:43 PM
  #14  
WishIownedOne
Heel & Toe
Thread Starter
 
WishIownedOne's Avatar
 
Member Since: Apr 2003
Location: Suagus Ca
Posts: 16
Likes: 0
Received 0 Likes on 0 Posts
Default Re: How a 3d Table works (HighHopes85)

Sorry for the delayed post, but I have been overly busy at work.
(and probably will be for a few more weeks).

I did not get a chance to take a look at the stall saver code you were talking
about, but..

When things get weird and it looks like the same values are being used, you have to go down to the code where it is used.

Almost all "modes" on the ECM have hysteresis to keep things from happening too fast or too often.

You will have to look and see if something gets "turned on" and then it can compare some more qualifiers to see if further action in needed.
Sometimes it takes several passes through a routine to meet the " mode"
quals.

I'm not saying this is the case for the stall saver mode as I have not had a chance to look at it. There are also some cases where certain parts of the code are not used with different car models. In that case the quals will never be met.

Ken

Get notified of new replies

To How a 3d Table works




Quick Reply: How a 3d Table works



All times are GMT -4. The time now is 08:04 PM.