Help With my First Patch
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
Help With my First Patch
Here's a bit of code I've written to make a hp calculation formula I'm using in tunerpro a little more useful. This saves the current mph for app. 1 sec then outputs it to the datastream. Look functional? Now I have no idea where to insert this snippet, and I need an idea of how to send this to the datastream inplace of the engine run time. Can I hand it off to the subroutine at LFC89 and change how the engine run time gets it's data? I'm using the ARAPWB patch. At some point I think someone needs to go through and clean up $6E to clear out some room for new code. I'm learning... slowly. Maybe that'll be my project at some point.
Last edited by bl85c; Dec 6, 2009 at 10:54 PM.
Moderator
iTrader: (1)
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
Car: check
Engine: check
Transmission: check
Re: Help With my First Patch
I'm not sure why you need to output the MPH each second to the data stream. The vehicle speed is already in the stream. Just use the engine run time counter at the PC end to know when to do the HP calculation. That too is in the data stream.
Should be able to get 11 frames of data a second from the ECM. This is at 8192 baud.
The easiest way to get more room in a BIN is to remove the factory test code. It is never used once the ECM is in a vehicle.
RBob.
Should be able to get 11 frames of data a second from the ECM. This is at 8192 baud.
The easiest way to get more room in a BIN is to remove the factory test code. It is never used once the ECM is in a vehicle.
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: Help With my First Patch
At the pc end? You mean with excel or something? I want to see the value in tunerpro. Engine run time doesn't display correctly with the ARAPWB patch so I need to use the 1 sec flag.
Moderator
iTrader: (1)
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
Car: check
Engine: check
Transmission: check
Re: Help With my First Patch
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: Help With my First Patch
I'm barely familiar with motorola's code, much less writing stuff for tunerpro, LOL. How would I hold the MPH in memory with tunerpro? I'm going to contact the guy that made the ARAPWB patch so I can get info on his patch, then start fresh with a clean ARAP with mode 2 & some other stuff cut out.
Moderator
iTrader: (1)
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
Car: check
Engine: check
Transmission: check
Re: Help With my First Patch
OK, i have a better idea of what you want to do. The way to do this is to find two free bytes of RAM. Then place the address of each of these bytes in the ALDL stream data look up table. This table defines what data is sent via the ALDL stream. Can replace some thing that is rarely used, such as the rich/lean counter and cooling fan PWM.
In the IRQ1 routine there is a 1-second section of logic. This code can be found in there:
In this code location you want to shift the 'current' MPH byte to the 'old' MPH byte. Then save the current MPH reading in the 'current' MPH byte. Basically you are shifting the current to the 1-second old and saving the new current MPH reading.
This way TP will have both the 1-second old MPH reading and the current MPH reading. Each being updated once a second.
Like this:
The OldMph and CurrentMph are RAM locations that are used to store the data. Those are the locations that are placed into the ALDL stream table.
RBob.
In the IRQ1 routine there is a 1-second section of logic. This code can be found in there:
Code:
CB1E: LDX L0019 ; ENG RUN TIME (sec) CB20: INX CB21: STX L0019 ; ENG RUN TIME (sec)
This way TP will have both the 1-second old MPH reading and the current MPH reading. Each being updated once a second.
Like this:
Code:
LDAA CurrentMph ; get the current MPH, now 1-second old STAA OldMph ; and save LDAA L0066 ; get current mph/1 STAA CurrentMph ; and save
RBob.
Trending Topics
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: Help With my First Patch
Here's what was done to run time with ARAPWB.
CB1A: LDAA #$00
CB1C: JSR LF2F7
CB1F: STAA $0170
CB22: NOP
;---------------------------------------------
;---------------------------------------------
; If no Comm >= 5 Sec Force mode 0
; (TM'R VAL AT C70B)
;---------------------------------------------
CB23: LCB23 LDAA L0166 ; SERIAL DATA TIME TO FORCE MD 0
CB1A: LDAA #$00
CB1C: JSR LF2F7
CB1F: STAA $0170
CB22: NOP
;---------------------------------------------
;---------------------------------------------
; If no Comm >= 5 Sec Force mode 0
; (TM'R VAL AT C70B)
;---------------------------------------------
CB23: LCB23 LDAA L0166 ; SERIAL DATA TIME TO FORCE MD 0
Moderator
iTrader: (1)
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
Car: check
Engine: check
Transmission: check
Re: Help With my First Patch
Here's what was done to run time with ARAPWB.
CB1A: LDAA #$00
CB1C: JSR LF2F7
CB1F: STAA $0170
CB22: NOP
;---------------------------------------------
;---------------------------------------------
; If no Comm >= 5 Sec Force mode 0
; (TM'R VAL AT C70B)
;---------------------------------------------
CB23: LCB23 LDAA L0166 ; SERIAL DATA TIME TO FORCE MD 0
CB1A: LDAA #$00
CB1C: JSR LF2F7
CB1F: STAA $0170
CB22: NOP
;---------------------------------------------
;---------------------------------------------
; If no Comm >= 5 Sec Force mode 0
; (TM'R VAL AT C70B)
;---------------------------------------------
CB23: LCB23 LDAA L0166 ; SERIAL DATA TIME TO FORCE MD 0
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: Help With my First Patch
It updates fairly quickly in the datalogs. I think he moved it to where the p.s. stuff was and didn't change the run time code back for some reason. If that's the case it can still be made to work. Is there a way lag the 2nd speed sample a sec behind rather than just outputting it once a second? Real time calc's would be nice... can it even hold on to a full sec of data without overrunning the memory with junk? Here's what was done to the p.s. section.
****FROM****
ldaa *L0066
cmpa LC576
bhi LCB7E
ldaa *L002F
coma
anda #0x08
oraa *L0038
staa *L0038
****TO******
ldaa *L0066
cmpa LC576
nop
nop
ldaa #0x00
jsr LF2F7
staa 0x0170
****FROM****
ldaa *L0066
cmpa LC576
bhi LCB7E
ldaa *L002F
coma
anda #0x08
oraa *L0038
staa *L0038
****TO******
ldaa *L0066
cmpa LC576
nop
nop
ldaa #0x00
jsr LF2F7
staa 0x0170
Last edited by bl85c; Dec 13, 2009 at 05:11 PM.
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: Help With my First Patch
Well 400z28racer's not responding. So back to my other question, can I do this real time without overloading the memory?
Banned
iTrader: (4)
Joined: Jul 2002
Posts: 1,267
Likes: 1
From: Usa
Car: 85 IROC-Z
Engine: magflatoVE
Transmission: T56
Axle/Gears: 9" 411
Re: Help With my First Patch
I am sorry, I've been busy writing VHDL code for the past 6 months. I'll be able to help you in the next few days.
Merry Christmas
Merry Christmas
Last edited by 400Z28Racer; Dec 25, 2009 at 11:37 AM.
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: Help With my First Patch
Ok time to bring this back from the dead. I went another direction and used another formula to get VE then esimated power from that. All I need help with now is getting the mat to work properly on your wb patch.
Last edited by bl85c; Feb 5, 2010 at 09:35 PM.
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: Help With my First Patch
Here's the formulas I'm working with. I'm obviously missing something because hp and torq are waaay off. VE looks accurate enough.
VE-
((X * .1323) / (491.67 / (459.67 + A) * .0808)) / ((B * R * 1) / 3456) * 100
Where A is MAT, B is engine displacement, R is RPM and X is MAF.
HP-
(A * C * (X * .01) * B * R) / 792001.6
Where A is atmospheric pressure, B is engine dispalcement, C is static compression ratio, R is RPM and X is VE.
Torq-
5252 * X / R
Where R is RPM and X is HP.
Edit- corrected formulas.
VE-
((X * .1323) / (491.67 / (459.67 + A) * .0808)) / ((B * R * 1) / 3456) * 100
Where A is MAT, B is engine displacement, R is RPM and X is MAF.
HP-
(A * C * (X * .01) * B * R) / 792001.6
Where A is atmospheric pressure, B is engine dispalcement, C is static compression ratio, R is RPM and X is VE.
Torq-
5252 * X / R
Where R is RPM and X is HP.
Edit- corrected formulas.
Last edited by bl85c; Feb 7, 2010 at 07:21 PM.
Joined: Apr 2004
Posts: 3,180
Likes: 3
From: Browns Town
Car: 86 Monte SS (730,$8D,G3,AP,4K,S_V4)
Engine: 406 Hyd Roller 236/242
Transmission: 700R4 HomeBrew, 2.4K stall
Axle/Gears: 3:73 Posi, 7.5 Soon to break
Re: Help With my First Patch
I was just wndering if "C" should be Dynamic Comp instead of Static.
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: Help With my First Patch
That doesn't help, probably because the formula assumes 100% ve and adjusts based on actual. Unless my car's suddenly making 1600hp I didn't know about! I did find out that LV8 and VE are essentially the same thing though after comparing the 2 in my datalogs, all that's needed is to change it to % rather than 0-255. So that simplifies things a little, no need for the mat or a separate ve calculation. These calculations seem to work out perfect on paper but gets goofed up in tunerpro somehow...
Last edited by bl85c; Feb 7, 2010 at 07:24 PM.
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: Help With my First Patch
Found it. Devil's in the decimal. Here's the correct hp formula. (A * C * (X * .01) * B * R) / 792001.6
It's alive!!!
It's alive!!!
Last edited by bl85c; Feb 7, 2010 at 06:56 PM.
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: Help With my First Patch
Looks like this is still estimating a little low. Other problem is it can't be used for forced induction using LV8 as VE. I need to figure out how to get the mat reading correctly again.
Thread
Thread Starter
Forum
Replies
Last Post
Xenodrgn
Tech / General Engine
1
Apr 25, 2001 09:36 PM
crazeinc
Suspension and Chassis
3
Feb 14, 2001 09:03 AM





