NefMoto

Technical => Reverse Engineering => Topic started by: leeimad on May 22, 2020, 09:12:56 AM



Title: MED9.1 time/seconds/lamp (multimap)
Post by: leeimad on May 22, 2020, 09:12:56 AM
Hello everyone
I am working on MED9.1 project map switching i want to customize the time of enabling the EPC lamp time after map i.e for 10 seconds.
until now i can enable or disable EPC lamp.
thank you for your help


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: _nameless on May 22, 2020, 11:54:53 AM
i think you forgot to attach your ida project :o  ::)


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: fknbrkn on May 22, 2020, 02:31:01 PM
Do some timer
What's the problem?


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: leeimad on May 22, 2020, 03:28:39 PM
Do some timer
What's the problem?
i did a map switching like basano
thats my new function to turn on/off the EPC light:
Code:
ROM:0047ED30                 lbz       r12, (switch - 0x7FFFF0)(r13)  a byte on memory to save wich mode is active
ROM:0047ED34                 cmpwi     r12, 0
ROM:0047ED38                 beq       loc_47ED58
ROM:0047ED3C                 lbz       r12, (B_nmin - 0x7FFFF0)(r13)
ROM:0047ED40                 cmpwi     r12, 0
ROM:0047ED44                 beq       loc_47ED58
ROM:0047ED48                 lbz       r12, (B_epcl - 0x7FFFF0)(r13)
ROM:0047ED4C                 ori       r12, r12, 0x20
ROM:0047ED50                 stb       r12, (B_epcl - 0x7FFFF0)(r13)
ROM:0047ED54                 b         loc_47ED64
ROM:0047ED58 # ---------------------------------------------------------------------------
ROM:0047ED58
ROM:0047ED58 loc_47ED58:                             # CODE XREF: BASANO_MAIN-7B2E8↑j
ROM:0047ED58                                         # BASANO_MAIN-7B2DC↑j
ROM:0047ED58                 lbz       r12, (B_epcl - 0x7FFFF0)(r13)
ROM:0047ED5C                 rlwinm    r12, r12, 0,27,25
ROM:0047ED60                 stb       r12, (B_epcl - 0x7FFFF0)(r13)
ROM:0047ED64
how can i add a instruction to make timer
many thanks


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: leeimad on May 23, 2020, 02:35:25 PM
I know that the instruction will by loading the adress of a timer variable and compare it to a value.
But i mean really wich timer could I use it


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: prj on May 23, 2020, 03:17:17 PM
All functions in the ECU are run within a scheduler in various timeslices, except for things that get run on init and crank-sync.
Almost all map lookups are ms scheduled.

A timer is as simple as creating a counter and incrementing it every time your code is run, comparing it to a stored value, and resetting it/running your logic once you go over it.

You just need to know where you are injecting code. Some things are 1ms, some are 10ms, etc.


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: leeimad on May 24, 2020, 07:06:39 AM
All functions in the ECU are run within a scheduler in various timeslices, except for things that get run on init and crank-sync.
Almost all map lookups are ms scheduled.

A timer is as simple as creating a counter and incrementing it every time your code is run, comparing it to a stored value, and resetting it/running your logic once you go over it.

You just need to know where you are injecting code. Some things are 1ms, some are 10ms, etc.
Many thanks Prj.
Could I use directly an included timer  for example a timer (stored in RAM) wich start counting after uning the engine?


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: fknbrkn on May 24, 2020, 01:37:06 PM
Buy an arduino and check the example projects with basic timers


Title: Re: MED9.1 time/seconds/lamp (multimap)
Post by: leeimad on May 24, 2020, 03:39:07 PM
thank you all