Page 3 of 5

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 15, 20:14
by efloth
Thanks jsa!

Ok i've got the call and the function addressed. Now I'm confused about what arg 2 is. Is it the lookup value for the function or the returned data?
R58 is the input from the map sensor and func_c1ac should return a value (not completed) for r56 (I will need a second function to lookup a value for r5c)

Code: Select all

Sub_38ff:
38ff: c3,e4,a2,58         stw   R58,[Re4+a2]     [122] = R58;
3903: ef,03,0e            call  4709             UUWFuncLU_4709 (
3906: fe,cd                     #arg 1              c1ac,
3908: 58,00                     #arg 2              58 );

Code: Select all

c1ac: 59,6c,00,00         func  27737,     0
c1b0: 64,5f,00,00         func  24420,     0
c1b4: 71,5a,00,00         func  23153,     0
c1b8: 7c,db,00,00         func  56188,     0
c1bc: 88,e0,00,00         func  57480,     0
c1c0: 96,72,00,00         func  29334,     0
c1c4: a2,3f,00,00         func  16290,     0
c1c8: ad,ff,00,00         func  65453,     0
c1cc: b9,ff,00,00         func  65465,     0
c1d0: c5,ff,00,00         func  65477,     0
c1d4: d1,ff,00,00         func  65489,     0
c1d8: dd,ff,00,00         func  65501,     0
c1dc: e9,ff,00,00         func  65513,     0
c1e0: f5,ff,ff,ff         func  65525, 65535

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 15, 20:28
by decipha
if register 58 is used above it would be my guess that its using that register

122 would be the last reading

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 15, 20:39
by efloth
I put in r58 for arg2 but then I realized I don't know if that is correct

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 15, 20:42
by decipha
Are you writing code? I'm not understanding??

I hadn't been following yalls convos though I just assumed you were going through the code.

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 15, 20:46
by efloth
Yes I'm writing the code to look up values for R5C and R56 instead of using nested IF statements with hard coded values. I will need two separate functions where r58 is the input returning values for the said variables

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 16, 02:45
by wwhite

Code: Select all

3903: ef,03,0e            call  4709             UUWFuncLU_4709 (
3906: fe,cd                     #arg 1              c1ac,
3908: 58,00                     #arg 2              58 );
Does 0xCDFE really translate to c1ac fater going through UUWFuncLU_4709? (line 3906)

I read this as,
- Unsigned Word Function Look Up using R58 in fox c1ac
- function c1ac(58), argument is R58.

Now, if you look at most code that calls UUWFuncLU_4709, the second argument is input, and the output will be stored in R38(word) or R39(byte) after it returns.
Don't know what R58 is, nor what your setting, not enough code.

I think your not looking at MAP_CALC function correctly. I understand what you want to do, but MAP CALC isn't the place to do it.
Take the lowest value of Frequency, 89hz, and the max possible setting of 165hz, we get a total of 76 possible Hz's. represented in hex, then convert back to decimal, that ~19,000 look up values.
Don't think the ten or so nested if/elses looks so bad.

R58 = MAP_FREQ, which is just an integer, no need to function lookup.
If you think the A/D frequency converter can read higher or lower values in a broader range, just adjust the max/min in the code up and down. That's the easy way.

Now, back to MAP_CALC subroutine.

Code: Select all

 The subroutine  "MAP  CALC"  consists  of  the  conversion  routine  for  MAP
      frequency into MAP_WORD.  The logic below is describing the method to perform
      the conversion [b][i]in the least number  of  steps.[/i][/b]
After the calculation of MAP_WORD, complete the following:

Code: Select all

  Set MUPET_FLAG = 1       (New MAP value for AEMAP calculation)
          Set ISF_UP_FLG = 1       (Ready to restart MAP calculation)
          Set DT12SA = 0           (Clear normal MAP time accumulator)
          Set MAPCNT = 0           (Clear normal MAP edge counter)
          Set MAPUP_NORM = 1       (New MAP value for MAP normalizing routine)

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 16, 02:46
by wwhite
Here are some directives to help your code out:

Code: Select all

sub  38ff "MAP_CALC"  

sym 52 "B5_ISF_UP_FLG_52" : B 5
sym a0 "B6_MUPET_FLAG_a0" : B 6
sym a1 "B0_MAPUP_NORM_a1"  : B 0
sym a6 "B3_MFMFLG_a6" : B 3
sym a7 "B0_V_VACFLG_a7" : B 0

sym ba "MAP"

sym 120 "DT12SA"
sym 122 "MAP_FREQ"
sym 124 "MAP_WORD"
sym 126 "IMAP_WORD"
sym 128 "MAPCNT"

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 16, 02:47
by wwhite
A partial example of the conversion tree is shown below:

Code: Select all

                                                        MAP_FREQ
                                                             |
                                                             |
                                       yes <-------- MAP_FREQ < MAPBK3 --------> no
                                        |                                        |
                                        |                                        |
                     yes <----- MAP_FREQ < MAPBK1 ------> no
                      |                                   |
                      |                                   |
      yes <-- MAP_FREQ < FMAP1 --> no     yes <-- MAP_FREQ < MAPBK2 --> no
       |                           |       |                            |
       |                           |       |                            |

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 16, 02:52
by wwhite
And, Finally, the logic that implements MAP_CALC(the tree above), same as the if/else block jsa posted, but this is straight from docs:

Code: Select all

  

      MAP_FREQ < MAPBK3 -----------|
                                   |
      MAP_FREQ < MAPBK1 -----------|AND -| IMAP_WORD = SLOPE1 * FMAP1 - OFSET1
                                   |     |
      MAP_FREQ < FMAP1 ------------|     |
                                         | --- ELSE ---
      MAP_FREQ >= MAPBK3 ----------|     |
                                   |     |
      MAP_FREQ >= MAPBK5 ----------|AND -| IMAP_WORD = SLOPE6 * FMAP2 - OFSET6
                                   |     |
      MAP_FREQ >= FMAP2 -----------|     |
                                         | --- ELSE ---
      MAP_FREQ < MAPBK3 -----------|     |
                                   |AND -| IMAP_WORD = SLOPE1 * MAP_FREQ - OFSET1
      MAP_FREQ < MAPBK1 -----------|     |
                                         | --- ELSE ---
      MAP_FREQ < MAPBK3 -----------|     |
                                   |AND -| IMAP_WORD = SLOPE2 * MAP_FREQ - OFSET2
      MAP_FREQ < MAPBK2 -----------|     |
                                         | --- ELSE ---
                                         |
      MAP_FREQ < MAPBK3 -----------------| IMAP_WORD = SLOPE3 * MAP_FREQ - OFSET3
                                         |
                                         | --- ELSE ---
      MAP_FREQ < MAPBK5 -----------|     |
                                   |AND -| IMAP_WORD = SLOPE4 * MAP_FREQ - OFSET4
      MAP_FREQ < MAPBK4 -----------|     |
                                         | --- ELSE ---
                                         |
      MAP_FREQ < MAPBK5 -----------------| IMAP_WORD = SLOPE5 * MAP_FREQ - OFSET5
                                         |
                                         | --- ELSE ---
                                         |
                                         | IMAP_WORD = SLOPE6 * MAP_FREQ - OFSET6

Re: Bench Testing MAP Sensor - Boost

Posted: 2022 Sep 16, 03:05
by wwhite
efloth wrote: 2022 Sep 15, 20:46 Yes I'm writing the code to look up values for R5C and R56 instead of using nested IF statements with hard coded values. I will need two separate functions where r58 is the input returning values for the said variables
R5C = OFSET#(1-6) = Offset for the sixth linear equation describing MAP as a function of frequency and inches of Hg.
R56 = SLOPE#(1-6) = Slope for the first linear equation for MAP.

Values for R5C and R56 are statically set, there are only 6 values for each.

If you are wanting to substitute values for MAP_WORD, you should find the background routine CNVERT, as that is exaclty what it does.

Here is a hint: Sub_3f8a