New to source code editing
#51
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
As far as a timer/counter...
Here's mine:
https://github.com/kerchakone/MerpMo...erpMod/Timer.c
May not work too great on this old CPU but the idea is there.
It's really simple. Need to find out how many cycles per second the CPU runs your code at. For this code I wrote it was about 15000 per second.
Then everytime the code is run it counts down 1. So you set the highest value you need and it counts down to 0. When it gets there execute what you need.
Again, this ECM had PLENTY of ram and was 32 bit so the code worked easily, but will need to be worked for these old cars.
You'll need at least 2 bytes of ram for a counter. And possibly another bit or two for execution flag and start flag.
Here's mine:
https://github.com/kerchakone/MerpMo...erpMod/Timer.c
May not work too great on this old CPU but the idea is there.
It's really simple. Need to find out how many cycles per second the CPU runs your code at. For this code I wrote it was about 15000 per second.
Then everytime the code is run it counts down 1. So you set the highest value you need and it counts down to 0. When it gets there execute what you need.
Again, this ECM had PLENTY of ram and was 32 bit so the code worked easily, but will need to be worked for these old cars.
You'll need at least 2 bytes of ram for a counter. And possibly another bit or two for execution flag and start flag.
Last edited by Vanilla Ice; 05-17-2016 at 03:59 PM.
#52
Member
Thread Starter
Re: New to source code editing
Could I just make it where it then jumps from a point to check if the knock counts are lower than the threshold and then turn the light off? Or would that cause the program to infinitely loop with checking if it is higher and checking if it is lower?
#53
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
You also keep saying knock counts. Please use knock retard instead. It will make your coding infinitely easier. I speak from experience. I don't know if you missed it or youre just typing counts still but meaning degrees, but use degrees of retard.
As far as looping, you MUST walk through the code you're writing to make sure there are no bugs or "loops." Take a value and go through the code to see where it ends up. Then take another value and do the same. You should be able to see every way it walks through and where it ends up. This is how you avoid loops and errors.
I found that in order to write in Antilag how I wanted there was a massive amount of coding I had to add in to keep it working correctly. I never went back to streamline it and it may have been done, but the original code is quite long.
#54
Member
Thread Starter
Re: New to source code editing
Ok sorry for using knock counts, That's how it was mentioned in the program. Anyways, since school is done Ill have much more time to work on this. And do you know how exactly fast the program runs all of this? I guess I just need a perspective view to understand things correctly. I was just wondering because if I put this at the end of the program how long it would actually take to start reading it. This is because I don't know if the program just reads down onto the next line if there are no jumps or interrupts?
#55
Member
Thread Starter
Re: New to source code editing
I feel like it is pretty straight forward in terms of just copying the same code but to turn it off if it is lower than the knock retard threshold. But I also feel like after the first time it runs to check if it is higher it should run the whole program again and then check to see if it is lower.
I guess now would be a good time to start learning how to actually make it jump from the middle of the "stock" code to my "patch area".
To do this I am assuming I need to find all the points where the "knock retard" value is loaded in and then after where it completes that portion jumps to my "patch" and executes the first part?
Code:
LF60B: ldab *L00A2 ;load knock counts to acumulator b cmpb 8EE5 ;compare knock retard to knock threshold bhi LF60C ;branch if hi to LF60C: clrb jsr LF60D LF60D: bset *L0038,#0x01 ;turn on check engine light LF60E: ldab *L00A2 ;load knock counts to acumulator b cmpb 8EE5 ;compare knock retard to knock threshold bhi LF60F ;branch if low to LF60F: clrb jsr LF610 LF610: bset *L0038,#0x00 ;turn off check engine light
To do this I am assuming I need to find all the points where the "knock retard" value is loaded in and then after where it completes that portion jumps to my "patch" and executes the first part?
#56
Supreme Member
iTrader: (1)
Join Date: Apr 2004
Location: Browns Town
Posts: 3,178
Likes: 0
Received 3 Likes
on
3 Posts
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: New to source code editing
Suggestion,
Don't use CEL for the indication (It will scare you the first time it turns on a WOT)
Find an open output and wire up an LED to it.
Use 1 RAM address,
If Knock retard >0 then increment up by 1.
If Knock Retard=0 then decrement by 1.
If RAM >0 = turn on light, RAM = 0, turn off light.
or use no RAM,
if Knock Retard >0, turn on the light.
if Knock Retard = 0, Turn off the light.
That option will give no residual delay of the light turning off.
Gets rid of any CEL/SES light conflicts in the code.
Don't use CEL for the indication (It will scare you the first time it turns on a WOT)
Find an open output and wire up an LED to it.
Use 1 RAM address,
If Knock retard >0 then increment up by 1.
If Knock Retard=0 then decrement by 1.
If RAM >0 = turn on light, RAM = 0, turn off light.
or use no RAM,
if Knock Retard >0, turn on the light.
if Knock Retard = 0, Turn off the light.
That option will give no residual delay of the light turning off.
Gets rid of any CEL/SES light conflicts in the code.
#58
Member
Thread Starter
Re: New to source code editing
But i was told that there are not too many outputs you can use on the 7730 ecm. That is why I would use the CEL. And this isnt neccsarily to be totally practical. Its just so can learn some of the ins and outs of the ecm for future tuning use.
Drew
Drew
#59
Member
Thread Starter
Re: New to source code editing
Ok so now does someone want to help be put this bit of code into a bin file?
Drew
Drew
#60
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
You ever get this going?
Here you can see how I started this venture:
https://www.thirdgen.org/forums/powe...ml#post6055449
Maybe you'd like to take my setup idea and make it better so I don't have to.
Here you can see how I started this venture:
https://www.thirdgen.org/forums/powe...ml#post6055449
Maybe you'd like to take my setup idea and make it better so I don't have to.
#61
Member
Thread Starter
Re: New to source code editing
I haven't gotten it going yet. I still need to figure out how to put a patch in a bin.
#62
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
How or where are you writing this patch?
If you're writing in hex just use a hex editor to edit the bin directly.
Right now I alter the Ida file and produce a dif file then use idapatcher.c to patch the bin.
If you're writing in hex just use a hex editor to edit the bin directly.
Right now I alter the Ida file and produce a dif file then use idapatcher.c to patch the bin.
#63
Member
Thread Starter
Re: New to source code editing
I was just modifying the text file to see what worked. I haven't done anything with assembling it back.
#64
Moderator
iTrader: (1)
Join Date: Mar 2002
Location: Chasing Electrons
Posts: 18,401
Likes: 0
Received 215 Likes
on
201 Posts
Car: check
Engine: check
Transmission: check
#65
Member
Thread Starter
Re: New to source code editing
I read through that whole thing twice and I can't seem to get the assembler to work. I don't know if it is because I have windows 10 or not.
#67
Member
Thread Starter
Re: New to source code editing
I have read the write up using tuner pro: https://www.thirdgen.org/forums/diy-...-tunerpro.html
but there were some steps that jumped to another without very much explanation.
but there were some steps that jumped to another without very much explanation.
#68
Senior Member
Join Date: Aug 2002
Location: ARIZONA
Posts: 948
Likes: 0
Received 4 Likes
on
4 Posts
Car: 92 Trans Am Conv
Engine: LB9
Transmission: T5
Axle/Gears: 3.08
Re: New to source code editing
I have read the write up using tuner pro: https://www.thirdgen.org/forums/diy-...-tunerpro.html
but there were some steps that jumped to another without very much explanation.
but there were some steps that jumped to another without very much explanation.
#69
Member
Thread Starter
Re: New to source code editing
Haha Yeah I guess. Would using tunerpro to change the hex file work though? Is that what you would use?
Thread
Thread Starter
Forum
Replies
Last Post
AmpleUnicorn88
South West Region
28
05-22-2017 12:47 PM
yevgenievich
Engine/Drivetrain/Suspension Parts for Sale
7
07-18-2016 07:47 AM
85@IRocZ
Engine/Drivetrain/Suspension Parts for Sale
21
05-17-2016 08:03 PM