Finished up a project I have had on the back burner for most of the year now. I've had been using efan code written by Fierobsessed over at FSC http://www.fullsizechevy.com/forum/g...n-code-0d.html, which works great, but wasn't exactly what I needed. So I decided to put together code that would be address all of the requirements I needed for my truck.


What this code does:
1. Operates an engine cooling fan with Fierobsessed's second version of efan code, but has code added to turn the fan on during high TPS operation.
2. Soft starts the engine fan. I wrote this section of code from scratch, my first!
3. Operates a second fan for the transmission cooler with Fierobsessed's first version of efan code, that I removed the AC control code from.

TPS added Fan Code with Soft Start Code and TransmissionFan Code:

Output Pins:
Pin E3 = CPI Tuning Valve(Engine Cooling Fan)
Pin E7 = AIR Control Solenoid (Transmission Cooling Fan)

Ram Variables:
L02A7 = MPH

L00A2 = Coolant Temperature
L00AE = TransmissionTemperature
L004D Bit 0 = A/C Status (1 = A/C Requested On)
L0052 Bit 3 = CPI Tuning Valve Output Control (Engine Fan Output Control)

L0046 Bit 2 = AIR OutputControl (Transmission Fan Output Control)
L0150 = Minimum Fan Run Timer

L0151 = Delay Timer
L01FC = TPS

Engine Fan Calibrations(160 degree thermostat):
L7000 ; AB ;Overheat Temperature for Fan On (190.9 deg F)
L7001 ; 9C ;Temperature for Fan On (170.6 deg F)
L7002 ; 9B ;Temperature for Fan Off (169.3 deg F)
L7003 ; 28 ;MPH for Fan Off (40 MPH)
L7004 ; DB ;TPS for Fan On (85.5% TPS)
L7005 ; 2D ;Minimum Fan Run Time (45 Seconds)


Engine Fan Soft StartCalibration:
L7092 ; 0020 ; Delay Time (32 PCMcycles)

Transmission FanCalibrations:
L7006 ; C8 ;Overheat Temperature for Fan On (200.3 deg F)
L7007 ; AE ;Temperature for Fan On (174.7 deg F)
L7008 ; 9F ;Temperature for Fan Off (159.8 deg F)
L7009 ; 32 ;MPH for Fan Off (50.0)
L700A ; DB ;TPS for Fan On (85.5% TPS)


Engine Fan Algorithms:
L7019 ; CE 70 00 ; LDX #L7000 ;Start of fan calibrations
L701C ; 12 52 08 26 ; BRSET L0052 #$08 L7046 ; If fan is on,

Skip to “Load MFR Timer variable”
L7020 ; 96 A2 ; LDAA L00A2 ;Load coolant temperature
L7022 ; A1 00 ; CMPA 0, X ;Compare to

“Overheat Temperature for Fan On”
L7024 ; 22 18 ; BHI L703E ;Go to "Turn on Fan" if higher

L7026 ; B6 01 FC ; LDAA L01FC ; Load TPS
L7029 ; A1 04 ; CMPA 4, X ; Compare to “TPS for Fan On”
L702B ; 22 11 ; BHI L703E ; Go to “Turn On Fan” if higher
L702D ; 12 4D 01 06 ; BRSET L004D #$01 L7037 ; If A/C is on, go to "Load MPH"
L7031 ; 96 A2 ; LDAA L00A2 ;Load coolant temperature
L7033 ; A1 01 ; CMPA 1, X ;Compare to

“Temperature for Fan On”
L7035 ; 23 37 ; BLS L706E ;Go to “Clear A Register” if Lower
L7037 ; B6 02 A7 ; LDAA L02A7 ;Load MPH
L703A ; A1 03 ; CMPA 3, X ;Compare to “MPH for Fan Off”
L703C ; 22 30 ; BHI L706E ;Go To “Clear A Register” if Higher
L703E ; 14 52 08 ; BSET L0052 #$08 ;Turn on fan

L7041 ; A6 05 ; LDAA 5, X ; Load “Minimum Fan Run Time”
L7043 ; B7 01 50 ; STAA L0150 ;Save “Minimum Fan Run Time”

to L0150
L7046 ; B6 01 50 ; LDAA L0150 ;Load MFR Timer variable
L7049 ; 26 16 ; BNE L7061 ;If timer is not zero go to

"Load MFR Timer variable"
L704B ; 12 4D 01 06 ; BRSET L004D #$01 L7055 ; If A/C is on, go to "Load MPH"
L704F ; 96 A2 ; LDAA L00A2 ;Load coolant temperature
L7051 ; A1 02 ; CMPA 2, X ;Compare to

“Temperature for Fan Off”
L7053 ; 23 09 ; BLS L705E ;Go to "Turn off fan" if lower
L7055 ; B6 02 A7 ; LDAA L02A7 ;Load MPH
L7058 ; A1 03 ; CMPA 3, X ;Compare to “MPH for Fan Off”
L705A ; 22 02 ; BHI L705E ;Go To "Turn off fan" if higher
L705C ; 20 10 ; BRA L706E ;Break Go To “Clear A Register”
L705E ; 15 52 08 ; BCLR L0052 #$08 ;Turn off fan
L7061 ; B6 01 50 ; LDAA L0150 ;Load MFR Timer variable
L7064 ; D6 02 ; LDAB L0002 ;Load Loop Counter
L7066 ; C4 F0 ; ANDB #$F0 ;Mask first 4 bits
L7068 ; 26 04 ; BNE L706E ;Skip to end if no

decrement of timer needed
L706A ; 4A ; DECA ;Decrease MFR Timer by 1
L706B ; B7 01 50 ; STAA L0150 ;Save MFR Timer to L0150
L706E ; 4F ; CLRA ;Clear A Register
L706F ; 5F ; CLRB ;Clear B Register
L7070 ; 39 ; RTS ;Return from subroutine


To Enable Engine Fan Subroutine:
L400E Bit 3 Variable Manifold Tuning Control = 0 (Not used)
L400F Bit 0 Governor Option = 0
L400F Bit 2 A/C ClutchControl/Variable Manifold Tuning Control = 0
Change hex editor values starting at 7C6E, from BD D3 99 to BD 70 19.
L7C6E ; BD D3 99 ; JSR LD399 ; Jump to CPI subroutine
L7C6E ; BD 70 19 ; JSR L7019 ; Jump to engine fan subroutine

Engine Fan Soft Start Algorithms:
L7071 ; 12 52 08 08 ; BRSET L0052 #$08 L707D ; Branch to turn on fan
L7075 ; CE 70 00 ; LDX #$7000 ; Load 0% Duty Cycle
L7078 ; FF 3F D4 ; STX L3FD4 ; Save to output fan off
L707B ; 20 44 ; BRA L70C1 ; Branch to return
L707D ; FC 3F D4 ; LDD L3FD4 ; Load fan output
L7080 ; 1A 83 77 FF ; CPD #$77FF ;Compare to 50% variable
L7084 ; 23 02 ; BLS L7088 ;Branch if equal or lower
L7086 ; 22 14 ; BHI L709C ;Branch if higher
L7088 ; CE 77 FF ; LDX #$77FF ; Load 50% Duty Cycle
L708B ; FF 3F D4 ; STX L3FD4 ; Save to output fan on at 50%
L708E ; FE 01 51 ; LDX L0151 ; Load delay timer
L7091 ; 8C 00 20 ; CPX #$0020 ; Compare to delay variable
L7094 ; 24 11 ; BHS L70A7 ; Branch if equal or higher
L7096 ; 08 ; INX ; Increase delay timerby 1
L7097 ; FF 01 51 ; STX L0151 ; Save new time
L709A ; 20 25 ; BRA L70C1 ; Branch to return
L709C ; FC 3F D4 ; LDD L3FD4 ; Load fan output
L709F ; 1A 83 7B FF ; CPD #$7BFF ;Compare to 50% variable
L70A3 ; 23 02 ; BLS L70A7 ; Branch if equal or lower
L70A5 ; 22 14 ; BHI L70BB ;Branch if higher
L70A7 ; CE 7B FF ; LDX #$7BFF ; Load 75% Duty Cycle
L70AA ; FF 3F D4 ; STX L3FD4 ; Save to output fan on at 75%
L70AD ; FE 01 51 ; LDX L0151 ; Load delay timer
L70B0 ; 8C 00 00 ; CPX #$0000 ; Compare to delay variable
L70B3 ; 23 06 ; BLS L70BB ; Branch if equal or lower
L70B5 ; 09 ; DEX ; Decrease delay timer by1
L70B6 ; FF 01 51 ; STX L0151 ; Save new time
L70B9 ; 20 06 ; BRA L70C1 ; Branch to return
L70BB ; CE 7F FF ; LDX #$7FFF ; Load 100% DC
L70BE ; FF 3F D4 ; STX L3FD4 ; Save to output fan on at 100%
L70C1 ; 7E CBDC ; JMP LCBDC ; Return to subroutine

To Enable Engine Fan SoftStart Subroutine:
Change hex editor valuesstarting at CBB2, from CE 7F FF to 7E 70 71.
LCBB2 ; CE 7F FF ; LDX L7FFF ; Preload full DC for output
LCBB2 ; 7E 70 71 ; JMP L7071 ; Jump to soft start routine

Transmission FanAlgorithms:
L70C4 ; CE 70 06 ; LDX #L7006 ; Start of fan calibrations
L70C7 ; 96 AE ; LDAA L00AE ; Load transmissiontemperature
L70C9 ; A1 00 ; CMPA 0, X ; Compare to
“Overheat Temperature for Fan On”
L70CB ; 22 1E ; BHI L70EB ; Go to turn on fan if higher
L70CD ; B6 01 FC ; LDAA L01FC ; Load TPS
L70D0 ; A1 04 ; CMPA 4, X ; Compare to “TPS for Fan On”
L70D2 ; 22 17 ; BHI L70EB ; Go to turn on fan if higher
L70D4 ; B6 02 A7 ; LDAA L02A7 ; Load MPH
L70D7 ; A1 03 ; CMPA 3, X ;Compare to “MPH for Fan Off”
L70D9 ; 22 15 ; BHI L70F0 ; Go to turn off fan if higher
L70DB ; 96 AE ; LDAA L00AE ; Load transmissiontemperature
L70DD ; 12 46 04 04 ; BRSET L0046 #$04 L70E5 ; If fan on, check if transmission
is cool enough to disable
L70E1 ; A1 01 ; CMPA 1, X ; Compare to
“Temperature for Fan On”
L70E3 ; 22 06 ; BHI L70EB ; Go to turn on fan if higher
L70E5 ; A1 02 ; CMPA 2, X ; Compare to
“Temperature for Fan Off”
L70E7 ; 23 07 ; BLS L70F0 ; Go to turn off fan if
lower or the same as
L70E9 ; 20 08 ; BRA L70F3 ; Branch to return
L70EB ; 14 46 04 ; BSET L0046 #$04 ; Turn on fan
L70EE ; 20 03 ; BRA L70F3 ; Branch to return
L70F0 ; 15 46 04 ; BCLR L0046 #$04 ; Turn fan off
L70F3 ; 7E CB 3A ; JMP LCB3A ; Return to output handling routine

To Enable TransmissionFan Routine:
L400B Bit 1 AIR Management= 1
Change hex editor values starting at CAFE, from 96 06 B1 to 7E 70 C4.
LCAFE ; 96 06 ; LDAA L0006 ; Cool temp, linear
; B1 4E 82 ; CMPA L4E82 ; Min temp for AIR
LCAFE ; 7E 70 C4 ; JMP L70C4 ; Jump to transmission fan routine

Hex Editor Values:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
7000: AB 9C 9B 28 DB 2D C8 AE 9F 32 DB 00 00 00 00 00
7010: 00 00 00 00 00 00 00 00 00 CE 70 00 12 52 08 26
7020: 96 A2 A1 00 22 18 B6 01 FC A1 04 22 11 12 4D 01
7030: 06 96 A2 A1 01 23 37 B6 02 A7 A1 03 22 30 14 52
7040: 08 A6 05 B7 01 50 B6 01 50 26 16 12 4D 01 06 96
7050: A2 A1 02 23 09 B6 02 A7 A1 03 22 02 20 10 15 52
7060: 08 B6 01 50 D6 02 C4 F0 26 04 4A B7 01 50 4F 5F
7070: 39 12 52 08 08 CE 70 00 FF 3F D4 20 44 FC 3F D4

7080: 1A 83 77 FF 23 02 22 14 CE 77 FF FF 3F D4 FE 01
7090: 51 8C 00 20 24 11 08 FF 01 51 20 25 FC 3F D4 1A
70A0: 83 7B FF 23 02 22 14 CE 7B FF FF 3F D4 FE 01 51
70B0: 8C 00 00 23 06 09 FF 01 51 20 06 CE 7F FF FF 3F
70C0: D4 7E CB DC CE 70 06 96 AE A1 00 22 1E B6 01 FC
70D0: A1 04 22 17 B6 02 A7 A1 03 22 15 96 AE 12 46 04
70E0: 04 A1 01 22 06 A1 02 23 07 20 08 14 46 04 20 03
70F0: 15 46 04 7E CB 3A 00 00 00 00 00 00 00 00 00 00

7C60: BD 70
7C70: 19

CAF0: 7E 70
CB00: C4

CBB0: 7E 70 71

Notes:
Duty Cycle %; $7000 = 0%,$73FF = 25%, 77FF = 50%, 7BFF = 75%, 7FFF = 100%.

Signed values used with Relative Addressing; 0 = $00, +127 = $7F, -128 = $80, -01 = $FF.

Lincoln Mark VIII fan, 3wires, Black ground, Black + engine operation, Blue + A/C operation; fan is PWM. On some replacement motors Black + is not used.

The soft start code is PWM,solid state relays must be used for the engine fan if using the soft start code. Use Hella P/N HL87251 / H41773001 / 5DF 007 867 00
Available from many places, all use different P/N. Search for Hella solid state relay.

Amperage rating for this relay is 22 amps, according to Hella’s web site. Some sellers are advertising higher amperage.

Use multiple relays, wired in parallel, to match your fan’s maximum amperage + 15%. My fan pulls 35 amps, so I used two relays for a total of 44 amps. (35 amps + 15% = 40.25 amps)

This relay will fit in a standard socket, and the pins are numbered the same as a standard relay, but the wiring is different.
30 = Battery+ (High Amperage)
87 = Load (Fan)
85 = Ground (HighAmperage)
86 = Switched Ground (PCM)