951-KLR-PAGES

DME region coding

Overview

There’s a simple overview of 944 region coding without the technical details - this article will explore the code that implements the region coding and other techinical stuff.

The 944 Turbo DME comes with special maps and other options for a total of four different “regions”. The regions listed in the Porsche documentation are:

In the software, the region is encoded via two separate bits: 25h.6 and T0. These are set by two physical adapters as follows:

The complete region selection logic then looks like this (closed means short-circuit):

Region Altitude connector Code plug 25h.6 T0
USA etc. open (closed above 3000ft) open 0 0
RoW 1.8k open 1 0
CA/Japan open closed 0 1
Switzerland/Sweden 1.8k closed 1 1

From this it’s easy to see that the altitude switch is not compatible with the RoW setup, i.e. having no cat/O2, since the altitude switch needs to be closed to trigger the high altitude adjustment, but that would interfere with RoW map selection.

First we’ll look at the logic that actually determines the region in the DME software. Then we’ll take a look at what difference(s) the region settings actually make.

Decoding the region

Inside the DME, the altitude switch connection goes to ADC channel 4, which has a 1k pull-up resistor. Therefore when the switch is open, channel 4 sees 5v and when the switch is closed, it sees 0v. When the switch is replaced with a 1.8k impedance adapter, then ADC channel 4 sees 5*(1.8k/1k+1.8k) = 3.2v (based on the standard resistor divider formula).

The routine at 1BD8 (which is called just after the TPS processing routine) uses the value read from channel 4 (stored in 14h) as the input to the following map:

Map 0x1296:

0x14 Value
0 1
46 3
128 2
200 0

In volts, this corresponds to:

volts Value
0 1
0.9 3
2.5 2
3.9 0

Clearly with the altitude switch present, we’ll get either 1 or 0 from this map, and with the 1.8k impedance adapter, we’ll get 2. In order to get 3, we’d need a resistor of approximately somewhere below 1.4k. This doesn’t seem to have been one of the documented options. In fact it would result in both 25h.6 and 25h.7 being set, which wouldn’t make much sense: 25h.7 indicates that an altitude correction (-6.25% fuel) is needed, so having this set all the time doesn’t seem useful.

The routine itself is very simple and works similarly to the TPS processing routine:

X1bd8:	
	mov	dptr,#X1296
	lcall	X05cd
	rrc	a
	mov	25h.7,c
	rrc	a
	mov	25h.6,c
	nop	
;
	org	1be7h
;
	jnb	25h.6,X1bee
	clr	20h.7
	ajmp	X1bf0
;
X1bee:	
	setb	20h.7

After reading the map we just looked at (located as 1296h), this code simply shifts the value read from the map into carry twice: the first result is stored into 25h.7 and the second into 25h.6. Thus the first bit being set (map output = 1 or 3) indicates that the altitude switch has triggered, and the second bit being set (map output = 2) indicates a RoW setup.

If 25h.6 is set, then 20h.7 is cleared, and vice-versa. The flag 20h.7 gates the lambda control routine.

The effect of region coding

The main effects of region coding are:

  1. map selection
  2. lambda control

Lambda

As noted earlier, if the car is coded as RoW, then lambda control is skipped completely.

If the car is coded as US or CA/Japan, then 20h.7 will be set and lambda control will run. But within the lamnda control routine, the state of T0 (code plug) modifies the maps used (see below for more detail).

Map selection

The main map selection is a little more complicated. For many fuel and timing maps, there are four choices, based on the code plug and the presence of the 1.8k impedance adapter.

The typical pattern we see throughout the code where region-dependent map look-ups happen is like this:

mov	r2,#4fh    ; load a map number into r2 (79 in this example)
acall	X1ff2  ; possibly add 1, 2 or 3 to r2 to select an alternate map
lcall	X051d  ; read the map pointed to by r2

Here, as usual r2 is loaded with the US-region map number (79 in this example, which is the main part throttle fuel map). But before calling the map read routine 051D, the region dependent map selection routine at 1FF2 is called, which can modify the map number stored in r2:

X1ff2:	
	clr	a
	mov	c,t0
	rlc	a
	mov	c,25h.6
	jnc	X1ffd
	rlc	a
	add	a,r2
	mov	r2,a
X1ffd:	
	ret

The effect of the first three instructions is to load a with the value of T0. Next we check 25h.6 - if this is clear, we return without changing r2 at all. Thus the code plug only matters if the 1.8k impedance adapter is also in place. This makes the CA/Japan region unreachable in this routine: those regions use the same maps as the US version any time this routine is used.

If 25h.6 is set, then we end up rotating a left again and adding 25h.6. So if we already had a=1 (from T0 being set) then we now have a=3, otherwise we just have a=1. Finally the result is added to r2.

Thus we return with r2 either unchanged, or with 1 or 3 added. Sticking with our example from earlier, we would get the following result depending on the region coding:

Hardware configuration Region Part throttle fuel map
No 1.8k adapter or code plug US 79
1.8k adapter, no code plug RoW 80
1.8k adapter, with code plug Switzerland/Sweden 82

Clearly the CA/Japan region is not reachable in this map selection routine, because the routine short-circuits any time 25h.6 is not set. However, it’s not totally redundant: the code plug does affect the maps used in lambda control, as I mentioned earlier. Here’s the relevant code:

X1d15:	
	mov	r2,#3eh ;Map 62
	jb	25h.6,X1d1f ; 25h.6=1 means RoW, so 20h.7 would not be set (see 1BEE)
	jnb	t0,X1d1f
	mov	r2,#41h  ;Map 65
X1d1f:	
	ljmp	X0a65

The logic here selects Map 65 as an alternate of Map 62 if T0 (code plug) is set. Of course the entire lambda routine is skipped if 25h.6 is set (1.8k impedance adapter), therefore T0 being set at this point corresponds to the CA/Japan region (see the table at the beginning of this article). The code block at 0A65 subsequently looks up the next two consecutive maps, so if the code plug is absent these will be 63 and 64, but if it’s present, they will be 66 and 67. In fact only 64/67 are different - these are the maps for the changed/not lean condition.

There is one more way in which alternate maps can be selected: the cold start flags 25h.4 and 25h.5. These two flags record whether or not the temperature was below 15C when the car was started - but this only happens when 25h.6 is not set, i.e. only for catalytic coverted equipped cars. The warmup fuel and ignition timing are adjusted based on the setting of these cold start flags.

In addition to the 25h.6 and t0 flags, the cold-start flags 25h.4 and 25h.5 are used at 1D10 which adds 2 (i.e. selects the CA/Japan maps).

Maps

Here’s a list of the maps that actually differ across the different regions for the 951 and 944 8v NA cars, along with their actual raw locations. Note that in some cases, the different region’s maps are just pointers to the same data as the US map. In other regions, they have their own separate definitions, but neverthless contain the same data. In still other cases, they really are different.

For more info on maps and their useage, see the Maps section of the main DME memory map article.

In the tables below, “differs” means the region’s map differs from the US version which I’m taking as the baseline map, and the hexidecimal value after the @ symbol is the map’s actual location (see the explanation of how Motronic map lookups work if that doesn’t make sense).

951

Map description US (+0) RoW (+1) California/Japan (+2) Switzerland/Sweden (+3)
timing, idle, temperature correction 4 @13BC 5 @17D8 differs 6 @1B04 same data 7 @19F0 differs
timing, idle, main 8 @13AC 9 @17C8 differs 10 @13AC points at US 11 @19E0 differs
timing, WOT 14 @1376 15 @17A6 same data 16 @1376 points at US 17 @19BE same data
timing, part throttle, temperature correction 18 @13C4 19 @17E0 differs 20 @1B0C differs 21 @19F8 differs
low-rpm acceleration enrichment 29 @15D3 30 @18DA differs 31 @15D3 points at US 32 @1AF2 differs
all-rpm acceleration enrichment 34 @15B2 35 @18D0 differs 36 @15B2 points at US 37 @1AE8 differs
warmup enrichment 43 @1465 44 @17E8 differs 45 @1B14 differs 46 @1A00 differs
fuel, idle 49 @1538 50 @18A2 same data 51 @1538 points at US 52 @1ABA same data
fuel, WOT 75 @1544 76 @18AE same data 77 @1544 points at US 78 @1AC6 same data
fuel, part throttle 79 @148C 80 @17F6 differs 81 @148C points at US 82 @1A0E differs
idle stabilizer load limit 87 @164F 88 @18E2 same data 89 @164F points at US 90 @1AFA same data
timing, part throttle, main 91 @12CA 92 @16FA differs 93 @12CA points at US 94 @1912 differs

944NA

Map description US (+0) RoW (+1) California/Japan (+2) Switzerland/Sweden (+3)
timing, idle, temperature correction 4 @13BC 5 @17BE same data 6 @1AEA same data 7 @19D6 same data
timing, idle, main 8 @13AC 9 @17AE differs 10 @13AC points at US 11 @19C6 same data
timing, WOT 14 @1376 15 @178C same data 16 @1376 points at US 17 @19A4 differs
timing, part throttle, temperature correction 18 @13C4 19 @17C6 same data 20 @1AF2 same data 21 @19DE same data
low-rpm acceleration enrichment 29 @15D3 30 @18C0 differs 31 @15D3 points at US 32 @1AD8 differs
all-rpm acceleration enrichment 34 @15B2 35 @18B6 same data 36 @15B2 points at US 37 @1ACE same data
warmup enrichment 43 @1465 44 @17CE differs 45 @1AFA differs 46 @19E6 same data
fuel, idle 49 @1538 50 @1888 differs 51 @1538 points at US 52 @1AA0 same data
fuel, WOT 75 @1544 76 @1894 differs 77 @1544 points at US 78 @1AAC differs
fuel, part throttle 79 @148C 80 @17DC differs 81 @148C points at US 82 @19F4 same data
idle stabilizer load limit 87 @164F 88 @18C8 differs 89 @164F points at US 90 @1AE0 same data
timing, part throttle, main 91 @12CA 92 @16E0 differs 93 @12CA points at US 94 @18F8 differs