Fuel Trip Computer build thread

XR4Ti / Sierra / Sierra Cosworth Discussions - Questions, problem resolution, general talk, technical tips and modifications.
Post Reply
Merkur Club web site
User avatar
Merkur
Moderator
Posts: 592
Joined: Mon Jan 06, 2003 12:13 am
Location: Doylestown, PA
Contact:

Fuel Trip Computer build thread

Post by Merkur » Mon Oct 12, 2020 10:28 pm

Over the years there have been several requests from Merkur owners looking to install the Euro Fuel trip computer in their XR4. I did this 20 years ago when the availability of parts, and communication sharing channels, was a lot more difficult. Last month the topic again resurfaced on Facebook so I decided to start a thread here on the forum since Facebook is the worst place to share designs and discuss issues.

About 20 years ago I decided to install the Sierra fuel computer in my '89 XR. There is a lot of evidence that this was going to be offered in the 1990 model year and in fact ONE of the connectors you need was found behind the instrument cluster. As I have stated in the past when people ask me how this was done, the major problem was that the computer was designed for the 6 cylinder Euro motor and not our four cylinder turbo motor. Therefore the fuel computer module multiplies injector pulses by six to come up with a fuel quantity used. In our Merkur application this needs to be multiplied by four. The solution I used was a PIC processor but today there are a lot easier solutions like the ESP 8266 and others. My solution works, and has been untouched or tweaked for 20 years.

I uploaded a series of photos here and in this thread I will be uploading the manuals and support information I used for the design. This is not a proprietary solution so feel free to tweak it as needed. I owe a lot to Dan Stokes who I worked with 20 years ago on the code. There was a lot of reverse engineering and conversions that happened back then and I remember one particular 'ah-ha' moment when I realized that I was 'expecting the fuel flow to be in Gallons/hour when in fact it was in Lb/Hour. There may be easier ways today but in essence what I did was:
* Get a Euro Fuel computer from Germany
* Get the harness wiring off a Sierra in Scotland[/list]
* Trace the wiring on the Merkur and to my surprise find a mating connector behind the instrument cluster*
* Build a Programmable controller to do the matth conversions
* Perform multiple test runs to calibrate the system
* Install the fuel computer in place of the digital clock
* Install the logic box behind the dash 'pocket above the glove box[/list]

This provides me with:
* An analog clock
* Distance to empty
* Total fuel used since hitting 'Clear'
* Instantaneous MPG
* Average Fuel MPG

In order to do this the computer needs:
* Fuel tank input. This was found on the 'D' shaped connector behind the Instrument Cluster
* Fuel flow. This was picked up from the EEC
* Speed sensor input. This was found on the 'D' shaped connector behind the Instrument Cluster
* 12V power. I generated 5V from this for the PIC MicroController using a 7805 regulator
* Backlight illumination from the standard dash bulbs [/list]

I have included below the supporting information and software code used. I hope this is useful to others.

All the best
Paul "the Brit" West
Doylestown, PA

User avatar
Merkur
Moderator
Posts: 592
Joined: Mon Jan 06, 2003 12:13 am
Location: Doylestown, PA
Contact:

Re: Fuel Trip Computer build thread

Post by Merkur » Mon Oct 12, 2020 10:44 pm

Ford Fuel Computer handbook images:
Attachments
Image (201).jpg
Page 9
Image (201).jpg (640.4 KiB) Viewed 63 times
Image (200).jpg
Page 8
Image (200).jpg (861.29 KiB) Viewed 63 times
Image (199).jpg
Page 7
Image (199).jpg (601.25 KiB) Viewed 63 times
Image (198).jpg
Page 6
Image (198).jpg (674.12 KiB) Viewed 63 times
Image (197).jpg
Page 5
Image (197).jpg (593.21 KiB) Viewed 63 times
Image (196).jpg
Page 4
Image (196).jpg (789.69 KiB) Viewed 63 times
Image (195).jpg
Page 3
Image (195).jpg (322.31 KiB) Viewed 63 times
Image (194).jpg
Page 2
Image (194).jpg (361.65 KiB) Viewed 63 times
Image (193).jpg
Page 1
Image (193).jpg (413.25 KiB) Viewed 64 times
Paul "the Brit" West
Doylestown, PA

User avatar
Merkur
Moderator
Posts: 592
Joined: Mon Jan 06, 2003 12:13 am
Location: Doylestown, PA
Contact:

Re: Fuel Trip Computer build thread

Post by Merkur » Mon Oct 12, 2020 11:09 pm

This is the schematic for the adapter designed to convert the Euro engine configuration to the Merkur configuration:
Merkur Trip computer adapter 2.jpg
Merkur Trip computer adapter 2.jpg (267.05 KiB) Viewed 61 times
Paul "the Brit" West
Doylestown, PA

User avatar
Merkur
Moderator
Posts: 592
Joined: Mon Jan 06, 2003 12:13 am
Location: Doylestown, PA
Contact:

Re: Fuel Trip Computer build thread

Post by Merkur » Mon Oct 12, 2020 11:19 pm

Software running on the PIC 12C508 Microcontroller. Interestingly I just looked up if these were still available and they are. In mid-1999 I paid $1.88 for them from DigiKey. Today they are $1.01 from the same source!


[code]
;*******************************************************************
; FUELCNT0.ASM
;
; Measures Pulse Width of "Injector On" signal (Port GP0), and
; Outputs pulses (On Port GP2) for specific amount of fuel.
;
;
;*******************************************************************
;
;
;*******************************************************************
;
LIST P=12C509
CNFIG equ 0x00E ;000000001110b
;New advice is to make all unused config bits ZERO
;( (_IN_OSC) & (_WDT_ON) & (_CP_OFF) & (_MCLRE_OFF) & (__12C509) )
__CONFIG ( CNFIG )

; PIC12C509 is the target processor
include C:\PIC\MICRO\P12C509.INC
org 0x0007 ; Point $ at top of File GPR
cnt0 equ $ + 0 ; lowest 8 bits of counter
cnt1 equ $ + 1 ; highest 8 bits of counter
outlev equ $ + 2 ; holds last output of FUELOUT
wb0 equ $ + 3 ; Working Byte Zero (scratch pad ram)
Same equ $ + 4 ;
fpending equ $ + 5 ; Indicates how many pulses are pending output

PWMIN EQU 0 ; This is our "fuel" PWM input
FUELOUT EQU 2 ; This is our fuel volume out output

;
; **************** Reset Vector Setup ******************
;
org 0 ;reset vector
goto start ;jump to start
;
;
; ***************************** Begin Counting Routine
;
org 1 ;Start of code space


start movwf OSCCAL ;Move Oscillator calibaration into OSCCAL
movlw 0xC7 ; 11000111
; | !- Timer0 / 256
; !--- Prescaler assigned to TMR0
option ;Move the above (1100 0111) into OPTION
movlw 0x3B ;move 0011 1011 into W
tris GPIO ;move W into TRIS
; Vss- P8 Power Gnd
; GPIO.0- P7 INPUT Fuel PWM
; GPIO.1- P6 INPUT N/C
; GPIO.2- P5 OUT ~~ Fuel Count
; GPIO.3- P4 By default INPUT ONLY
; GPIO.4- P3 INPUT N/C
; GPIO.5- P2 INPUT N/C
; Vdd- P1 Power +5.0V
;
; +---\__/---+
; +5.0V Vdd | 1 8 | Vss GND
; | |
; N/C GP5 | 2 7 | GP0 Fuel PWM (INPUT)
; | |
; N/C GP4 | 3 6 | GP1 N/C
; | |
; N/C GP3 | 4 5 | GP2 Fuel Count (OUTPUT)
; +----------+
;
;
movlw 0xDB ; move 1101 1011 into W
movwf GPIO ; Setup our I/O port
bcf outlev,0 ; set outlev.0 low
bcf GPIO,FUELOUT ; turn off our fuel output (LOW)

cnt_reset
; For 47,000 Pulses/Gallon, we need 5319uS/Pulse counted
; cnt0 = 38
; cnt1 = 4
; = (4 * 1282) + (38 * 5)
movlw 0x04 ;move 4 into w
movwf cnt1 ;move w into high byte <--- NOTE This is the calibration constant that was tweaked a lot during
Road Testing. I believe the final number used was 197 (0xC5)
movlw 0x26 ;move 38 into w
movwf cnt0 ;move w into low byte
mc_loop
clrwdt ;clear the PIC's Watch Dog Timer
btfsc GPIO,PWMIN ;If pin is low, skip next (begin count)
goto mc_loop ;PWMIN was high, wait for action
goto got_pulse ;we've got a pulse, don't check twice
check_pulse ;we're returning from counting a pulse
; ***** Start counting ICL here
btfsc GPIO,PWMIN ;If pin is low, skip next (count on)
goto pulse_done ;PWMIN went high, wait for action
got_pulse ;If we're here, we're counting a pulse
decfsz cnt0,F ;decrement cnt0, if zero skip next inst.
goto check_pulse ;if cnt0 <> 0 after DEC then loop back
; ***** Delay ICL = 5*CNT0
clrwdt ;clear WDT (every 256 cnt0's)
decfsz cnt1,F ;decrement cnt1, if zero skip next inst.
goto check_pulse ;if cnt1 <> 0 after DEC then loop back
; ***** Delay ICL = 5*CNT0 + 1282*CNT1
;We've timed out ... so its time to swap our "FUEL OUT" pulse

incf fpending,F ;indicate that we have a fuel pulse
pending
goto cnt_reset ;don't waste time, count more fuel
;
pulse_done ;fuel counting is done for the moment
incf fpending,F ;add 1 to our fuel pulse pending
decfsz fpending,F ;subtract pulse we just added
goto fuel_out ;if there was a pulse pending, send it
goto mc_loop ;if result was zero, then return to the
; 'main counting' wait loop
fuel_out ;
; If outlev.0 is high, then make the output pulse low
; ... if it was low then make the output pulse high
;
; Invert fuel out pulsewidth here
;
btfsc outlev,0 ;check bit 0 of outlev
goto outhigh ;the fuel output is currently high
;if we've made it here, the output is low
bsf outlev,0 ;set outlev.0 high
bsf GPIO,FUELOUT ;raise output of 'fuelout' pin
goto fuel_exit ;we are done with fuel outputs
outhigh ;if we've made it here, our output is high
bcf outlev,0 ;set outlev.0 low
bcf GPIO,FUELOUT ;lower output of 'fuelout' pin
;
fuel_exit
decf fpending,F ;subtract 1 from pending pulses
goto mc_loop ;return to the loop we started with
;
;*********************************************************************
;
END
[/code]
Paul "the Brit" West
Doylestown, PA

User avatar
DPDISXR4Ti
Site Admin
Posts: 13745
Joined: Wed Jan 08, 2003 11:40 pm
Location: New York

Re: Fuel Trip Computer build thread

Post by DPDISXR4Ti » Tue Oct 13, 2020 12:56 pm

Thanks for documenting this Paul.

Me being me, I'd probably use this as an excuse to do a V6 engine swap so as to avoid the complicated part. :mrgreen:
Brad

User avatar
John Brennan
Level 8
Posts: 11629
Joined: Wed Jun 18, 2003 4:19 pm
Location: Scottsdale, AZ "Summer Is Coming"

Re: Fuel Trip Computer build thread

Post by John Brennan » Tue Oct 13, 2020 1:08 pm

DPDISXR4Ti wrote:
Tue Oct 13, 2020 12:56 pm
Thanks for documenting this Paul.

Me being me, I'd probably use this as an excuse to do a V6 engine swap so as to avoid the complicated part. :mrgreen:
:withstupid "You cray-see!" But thank you... :notworthy
This is my car, and these are my people!
1989 XR4Ti 5-Speed
2001 BMW Z3 3.0 5-Speed
2015 Fiesta ST 6-Speed
2015 Edge 3.5 V6 Auto/Paddles

Post Reply