[Gmecm] $58 Baro code

Dig turbodig
Tue Jul 24 17:36:31 UTC 2007


I've been racking my brain for a while on this... hopefully someone can point out something obvious that I'm missing?

(Apologies for the formatting... yahoo doesn't do proportional fonts anymore, apparently)

The thing I can't figure out is how it even works at all in 2 bar mode (other than to set the value to the default).

The only thing I can figure out, is that this line:

 LF69E    brclr    L0022, #%00100000, LF6AF    ; Branch if IGN > 9 V (hyst w/4 V)

*could* evaluate to false on some cranking conditions.

Otherwise it's gonna jump to:

LF6AF    brclr    L0023, #%10000000, LF713     ; Branch if Engine is not running  (goes to default/exit)

    ldaA    VRPM_25                 ; RPM/25

    cmpA    KBARSPDA             ; RPM Threshold ($B8*25d = 4600 RPM) BARO update threshold

    bhi    LF713                 ; If RPM above threshold, jump around

    ldaA    $8334                ; AF Option flags

    bitA    #%00100000            ; 2 ATM MAP

    bne    LF725                ; Do the following for a 1 BAR MAP sensor.  Jump if 2ATM sensor


...and at the end, if it's a 2 bar sensor, it gets out of the routine entirely, without doing the default.


The bizarre thing is that it appears that it actually does get a good BARO reading at times... a believeable one.
Only thing I can make of it is that bit for IGN >9 is cleared at some time.  And, it doesn't appear to limit the conditions of the calculation when it does... low bat voltage anytime will reset BARO, to potentially an incorrect value.

This ends up in a bad boost calculation, and a bad vacuum calc as well.  Since there are some timing tables that are based on Vac and or boost, it can make for some flaky operation.

The other possibility is that I'm completely misinterpreting the function of that IGN > 9 flag. I've looked at that quite a bit, and it seems right.

Completely different branch of thinking... would it be possible to do running BARO calc with a 2 or 3 bar sensor?
It should be able to work the same way, although the F59 table would need to change to get accurate readings. Would these be calculated values, or just empirically derived? It would be nice to have a BARO that updates as you drive, for folks in mountain areas where altitudes can change fairly rapidly.

Simple fix would be to just calc it based on MAP readings with engine not running....

Thoughts?

Dig





;*******************************************************
; BARO Update Logic called by :
;  - Loop 1
;  - hc11vec_04
;*******************************************************
LF698:    brclr    L002A, #%11000000, LF69E      ; If Code 34 (low MAP) and Code 33 (hi MAP) clear then branch
    jr    LF713

LF69E    brclr    L0022, #%00100000, LF6AF    ; Branch if IGN > 9 V (hyst w/4 V)
    ldaA    L003F                 ; 2ATM Filtered MAP A/D 
    cmpA    #$4F                ; $7D = 125 = ~100kPa
                        ;changed to 4F by dig for 3bar purposes. Using the x * 1.23 +2.2
    bcs    LF6AA                ; If Filtered MAP < 100kPa, update 0017
    jr    LF725

LF6AA    staA    L0017                ; 2ATM BARO A/D
LF6AC    clrA    
    jr    LF70A
;
; I think this is the engine running baro update routine.  
;
LF6AF    brclr    L0023, #%10000000, LF713     ; Branch if Engine is not running
    ldaA    VRPM_25                 ; RPM/25
    cmpA    KBARSPDA             ; RPM Threshold ($B8*25d = 4600 RPM) BARO update threshold
    bhi    LF713                 ; If RPM above threshold, jump around
    ldaA    $8334                ; AF Option flags
    bitA    #%00100000            ; 2 ATM MAP
    bne    LF725                ; Do the following for a 1 BAR MAP sensor.  Jump if 2ATM sensor
    
; BARO calculation for 1ATM Sensor
    ldaB    L0055                ; Scaled TPS Last Loop?
    subB    L0053                ; Scaled TPS
    bcc    LF6C8                ; Branch if we are depressing the throttle
    negB                    ; Negate the value if we're letting go of the throttle
LF6C8    cmpB    #$03                ; 1.17% Delta TPS
    bcc    LF713                ; Branch if greater than 1.17% Delta TPS
    ldaB    L003D                ; 1 ATM MAP A/D
    cmpB    VBARO_AD                ; 1 ATM BARO A/D
    bhi    LF6AC                ; Branch if MAP is greater than BARO
    ldaB    L0053                ; Scaled TPS
    cmpB    #$60                ; 37.5%
    bcs    LF713                ; Don't do this if TPS is lower    
    ldaA    VRPM_25                ; RPM/25
    cmpA    #$30                ; 1200 RPM?
    bcs    LF713                ; Don't do this if RPM is lower
    cmpA    #$C0                ; 4800 RPM?
    bhi    LF713                ; Don't do the following if RPM too high.
    lsrB                    ; Scaled TPS/2
    pushB                    ; Save to Stack
    ldaB    #$55                ; 
    mul                    ; D = RPM/25 * $55 (85)
    bcc    LF6EA    
    incA                    ; Increment A if overflow occurred
LF6EA    popB                    ; TPS/2
    ldX    #F59                ; Offset to MAP reading for BARO adjustment with RPM and TPS
    call    LF5E6                ; 3D Lookup A=RPM*55/25, B=TPS/2
    cmpA    KMAXOFF                ; Maximum MAP Offset for BARO adjustment
    bls    LF6F7                ; Branch if table result is <= Threshold
    ret    
;*******************************************************
; END BARO Update Logic
;*******************************************************

LF6F7    pushA                    ; Save A to stack for later
    call    LF7FC                ; BARO scalar
    ldaB    #$60
    ldX    #F11P                ; Altitude Compensation for MAP offset
    call    LF5AF                ; 2D lookup w/offset
    popB                
    mul                    ; Multiply table output by the table lookup value
    lslD                    ; D = D * 2
    bcc    LF70A
    ldaA    #$FF
LF70A    ldaB    L003D                ; 1 ATM MAP A/D
    aBA                    ; A = A + B
    bcc    LF723                ; Branch if we didn't overflow
    ldaA    #$FF                ; Limit result to 255
    jr    LF723                ; Save the BARO value

LF713    ldaA    L0017                ; 2ATM BARO A/D
    bne    LF71C                ; If 0017 is zero, 
    ldaA    KAD2BARO            ; Default BARO for 2 ATM MAP config 
    staA    L0017                ; 2ATM BARO A/D
LF71C    ldaA    VBARO_AD            ; 1ATM BARO A/D
    bne    LF725                ; Branch if not equal to Zero
    ldaA    KADBARO                ; Default BARO for 1 ATM MAP config?
LF723    staA    VBARO_AD            ; 1ATM BARO A/D
LF725    ret    
; *********************************************
; ********* End BARO Update Logic *************
; *********************************************






More information about the Gmecm mailing list