Calling all gurus

Mike Pitts mpitts at mail.emi.net
Tue Sep 8 04:18:32 GMT 1998


This is a multi-part message in MIME format.

------=_NextPart_000_0033_01BDDABE.207C4B60
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Hi all,

I'm to a point where I could use a wee bit of help.  First of all,=20
my mathmatical skills are weak, especially when it comes=20
to coefficients and lag filters.  (I never took calc).  Anyway,=20
I have a routine that I think is a lag filter, but it's different enough =

from the '7148 code that I'm not sure.  At a minumum, it's doing=20
a bit more than the '7148 version.

If anyone would care to explain the theory of lag filters/coefficients=20
to me, as well as tell me what the following routine does, I'd be=20
MUCH obliged.  BTW: I'll bet this same routine is in 90% of the=20
modern P4 ECUs.

You'll need a monospaced font for this

;**********************************************************
;*
;* Lag Filter Subroutine??
;*
;* Input example:
;* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
;* LDAA $00A0 - Sometimes an A/D value
;* LDAB #$80  - Coefficient?
;* LDX  $0315 - The 16-bit storage of the filtered value?
;* LDY  #$5925- ???
;*
;* Result:
;* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
;* 16-bit word in Accumulator D
;*
;**********************************************************

F047    3C          PSHX                ; Store X
F048    30          TSX                 ; X =3D (SP) + 1
F049    A3 00       SUBD        $00,x   ; D =3D D - X[0]
F04B    37          PSHB                ; store B
F04C    E6 00 25    LDAB        $00,y   ; B =3D Y[0]
F04F    25 03       BLO         $F054   ; if D < 0 goto $F054

F051    3D          MUL                 ; D =3D A * B
F052    20 04       BRA         $F058   ; goto $F058

F054    3D          MUL                 ; D =3D A * B
F055    A0 00 E3    SUBA        $00,y   ; A =3D A - Y[0]

F058    E3 00       ADDD        $00,x   ; D =3D D + X[0]
F05A    ED 00       STD         $00,x   ; X[0] =3D D
F05C    32          PULA                ; get A from stack (was B)
F05D    E6 00 3D    LDAB        $00,y   ; B =3D Y[0]
F060    3D          MUL                 ; D =3D A * B
F061    A9 01       ADCA        $01,x   ; A =3D A + X[1] + carry
F063    16          TAB                 ; B =3D A
F064    A6 00       LDAA        $00,x   ; A =3D X[0]
F066    89 00       ADCA        #$00    ; A =3D A + carry
F068    38          PULX                ; restore X
F069    39          RTS                 ; return

Thanks!!
-Mike
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Mike Pitts
Delray Beach, FL
mpitts at emi.net
http://www.emi.net/~mpitts/mike.htm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


------=_NextPart_000_0033_01BDDABE.207C4B60
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>
<HEAD>

<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<META content=3D'"MSHTML 4.72.2922.0"' name=3DGENERATOR>
</HEAD>
<BODY>
<DIV>&nbsp;</DIV>
<DIV>Hi all,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I'm to a point where I could use a wee bit of help.&nbsp; First of =
all,=20
</DIV>
<DIV>my mathmatical skills are weak, especially when it comes </DIV>
<DIV>to coefficients and lag filters.&nbsp; (I never took calc).&nbsp; =
Anyway,=20
</DIV>
<DIV>I have a routine that I think is a lag filter, but it's different =
enough=20
</DIV>
<DIV>from the '7148 code that I'm not sure.&nbsp; At a minumum, it's =
doing=20
</DIV>
<DIV>a bit more than the '7148 version.</DIV>
<DIV>&nbsp;</DIV>
<DIV>If anyone would care to explain the theory of lag =
filters/coefficients=20
</DIV>
<DIV>to me, as well as tell me what the following routine does, I'd be =
</DIV>
<DIV>MUCH obliged.&nbsp; BTW: I'll bet this same routine is in 90% of =
the </DIV>
<DIV>modern P4 ECUs.</DIV>
<DIV>&nbsp;</DIV>
<DIV>You'll need a monospaced font for this</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT=20
face=3DCourier>;*********************************************************=
*<BR>;*<BR>;*=20
Lag Filter Subroutine??<BR>;*<BR>;* Input example:<BR>;* =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>;*=20
LDAA $00A0 - Sometimes an A/D value<BR>;* LDAB #$80&nbsp; - =
Coefficient?<BR>;*=20
LDX&nbsp; $0315 - The 16-bit storage of the filtered value?<BR>;* =
LDY&nbsp;=20
#$5925- ???<BR>;*<BR>;* Result:<BR>;* =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>;* 16-bit word in=20
Accumulator=20
D<BR>;*<BR>;**********************************************************</F=
ONT></DIV>
<DIV><FONT face=3DCourier></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier>F047&nbsp;&nbsp;&nbsp;=20
3C&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
PSHX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
; Store X<BR>F048&nbsp;&nbsp;&nbsp;=20
30&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
TSX&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
; X =3D (SP) + 1<BR>F049&nbsp;&nbsp;&nbsp; A3=20
00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
SUBD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $00,x&nbsp;&nbsp; ; D =3D =
D -=20
X[0]<BR>F04B&nbsp;&nbsp;&nbsp;=20
37&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
PSHB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
; store B<BR>F04C&nbsp;&nbsp;&nbsp; E6 00 25&nbsp;&nbsp;&nbsp;=20
LDAB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $00,y&nbsp;&nbsp; ; B =3D =

Y[0]<BR>F04F&nbsp;&nbsp;&nbsp; 25 03&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

BLO&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $F054&nbsp;&nbsp; ; =
if D=20
&lt; 0 goto $F054</FONT></DIV>
<DIV><FONT face=3DCourier></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier>F051&nbsp;&nbsp;&nbsp;=20
3D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
MUL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
; D =3D A * B<BR>F052&nbsp;&nbsp;&nbsp; 20 =
04&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
BRA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $F058&nbsp;&nbsp; ; =
goto=20
$F058</FONT></DIV>
<DIV><FONT face=3DCourier></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier>F054&nbsp;&nbsp;&nbsp;=20
3D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
MUL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
; D =3D A * B<BR>F055&nbsp;&nbsp;&nbsp; A0 00 E3&nbsp;&nbsp;&nbsp;=20
SUBA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $00,y&nbsp;&nbsp; ; A =3D =
A -=20
Y[0]</FONT></DIV>
<DIV><FONT face=3DCourier></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier>F058&nbsp;&nbsp;&nbsp; E3=20
00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
ADDD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $00,x&nbsp;&nbsp; ; D =3D =
D +=20
X[0]<BR>F05A&nbsp;&nbsp;&nbsp; ED 00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

STD&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $00,x&nbsp;&nbsp; ; =
X[0] =3D=20
D<BR>F05C&nbsp;&nbsp;&nbsp;=20
32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
PULA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
; get A from stack (was B)<BR>F05D&nbsp;&nbsp;&nbsp; E6 00 =
3D&nbsp;&nbsp;&nbsp;=20
LDAB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $00,y&nbsp;&nbsp; ; B =3D =

Y[0]<BR>F060&nbsp;&nbsp;&nbsp;=20
3D&nbsp;&nbsp;&nbsp;&nbsp;&nb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;&nbsp;&nbsp;&nbsp;&nbsp;=20
RTS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;=20
; return</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks!!</DIV>
<DIV>-Mike<BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>Mik=
e Pitts<BR>Delray=20
Beach, FL<BR><A href=3D"mailto:mpitts at emi.net">mpitts at emi.net</A><BR><A=20
href=3D"http://www.emi.net/~mpitts/mike.htm">http://www.emi.net/~mpitts/m=
ike.htm</A><BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0033_01BDDABE.207C4B60--




More information about the Diy_efi mailing list