Spark Vs AFR Table
Thread Starter
Supreme Member
iTrader: (2)
Joined: May 2007
Posts: 2,574
Likes: 0
From: right behind you
Car: '85 maro
Engine: In the works...
Transmission: TH700 R4
Axle/Gears: 3.73 posi
Spark Vs AFR Table
I was looking for help with this on another thread but I didn't get responses so I figured I'd create another around this. I'm trying to add a simple 8X1 table that adds spark based on the commanded AFR to my modified version of $6E. For some reason the code I wrote doesn't work. I've tried various code changes but nothing seemed to help. I output the converted AFR value in a datalog to see if it was actually doing anything and it just gives me a blank (00) value, so either the code isn't being run for some reason or I must not be handling the AFR value (L00D5) properly. All the start up spark code has been removed. This is what I wrote.
CE FF FF DC D5 02 C1 B8 23 02 86 B8 C6 48 CE C1 9D BD F3 F2 97 12
;-------------------------------------------------
;
; Lk Up Spark vs Commanded AFR Tbl
;
;-------------------------------------------------
F853: LDX #65535 ; LOAD 16B TO 8B CONV #
F856: LDD L00D5 ; COMMANDED AFR
F858: IDIV ; CONV TO TABLE UNITS
F859: CMPB #184 ; COMP TO MAX AFR FOR LK UP
F85B: BLS LF85F ; BR IF AFR LOWER
; ... else
F85D: LDAA #184 ; Force MAX AFR FOR LOOK UP
F85F: LDAB #72 ; MIN AFR FOR LK UP
F861: LDX #$C19D ; INDEX HWY MODE SPARK TBL
F864: JSR LF3F2 ; 2D lk up, W/MIN VAL
F867: STAA L0012 ; SAVE AFR SPARK ADVANCE
CE FF FF DC D5 02 C1 B8 23 02 86 B8 C6 48 CE C1 9D BD F3 F2 97 12
;-------------------------------------------------
;
; Lk Up Spark vs Commanded AFR Tbl
;
;-------------------------------------------------
F853: LDX #65535 ; LOAD 16B TO 8B CONV #
F856: LDD L00D5 ; COMMANDED AFR
F858: IDIV ; CONV TO TABLE UNITS
F859: CMPB #184 ; COMP TO MAX AFR FOR LK UP
F85B: BLS LF85F ; BR IF AFR LOWER
; ... else
F85D: LDAA #184 ; Force MAX AFR FOR LOOK UP
F85F: LDAB #72 ; MIN AFR FOR LK UP
F861: LDX #$C19D ; INDEX HWY MODE SPARK TBL
F864: JSR LF3F2 ; 2D lk up, W/MIN VAL
F867: STAA L0012 ; SAVE AFR SPARK ADVANCE
Last edited by bl85c; May 26, 2015 at 04:48 PM.
Moderator
iTrader: (1)
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
Car: check
Engine: check
Transmission: check
Re: Spark Vs AFR Table
There is a simple error in the high limit check. You are testing reg B, but then load reg A if the value is too high. Then reg B gets the table low offset parameter.
To go from the internal FAR value to an AFR value, need to reconstruct the IDIV. Note how IDIV works:
Operation: (ACCD)/(IX); IX: Quotient, ACCD: Remainder
LDD #65535 ; conversion constant
LDX L00D5 ; COMMANDED FAR
IDIV ; CONV TO TABLE UNITS
At this point the LSB of IX holds the AFR (times 10).
RBob.
To go from the internal FAR value to an AFR value, need to reconstruct the IDIV. Note how IDIV works:
Operation: (ACCD)/(IX); IX: Quotient, ACCD: Remainder
LDD #65535 ; conversion constant
LDX L00D5 ; COMMANDED FAR
IDIV ; CONV TO TABLE UNITS
At this point the LSB of IX holds the AFR (times 10).
RBob.
Thread Starter
Supreme Member
iTrader: (2)
Joined: May 2007
Posts: 2,574
Likes: 0
From: right behind you
Car: '85 maro
Engine: In the works...
Transmission: TH700 R4
Axle/Gears: 3.73 posi
Re: Spark Vs AFR Table
Didn't notice that, thanks
. Any idea as to why it returns 00 when I output it to datalog after the IDIV operation?
Edit- I may have answered my own question. Testing...
. Any idea as to why it returns 00 when I output it to datalog after the IDIV operation?Edit- I may have answered my own question. Testing...
Last edited by bl85c; May 26, 2015 at 07:48 PM.
Thread
Thread Starter
Forum
Replies
Last Post
HoosierinWA
Tech / General Engine
5
Oct 7, 2015 10:15 AM




