HOWTO: EZK Selector Pins

There are 5 unused pins on the EZK connector. These are the "selector pins". By default, only 18 and 19 serve a purpose.

EZK connector

Factory timing adjustments

AdjustmentPin 18Pin 19
No adjustmentNot connectedNot connected
-6 RetardedNot connectedGround
-3 RetardedGroundNot connected
+3 AdvancedGroundGround

Selector Pin Operation Details

The pins marked in red (18, 19, 21 and 25) are so called selector pins.

Each of these pins are connected to the processor like this:

EZK selector pins

Each pin have active pull-up resistor to the VCC, so they are in logical one state, but
goes to the CPU through an inverter so it sees them all as logical zero

Here is the mapping from pin number to the CPU port P4:

PIN 18 -- P4.4
PIN 19 -- P4.5
PIN 21 -- P4.6
PIN 25 -- P4.7

So, normally when all pins are unconnected (floating) the CPU sees zero on the port P4

By grounding all or none, or combinations of these pins we can get 16 combinations:

binary hexadecimal decimal
0000 0x00 0
0001 0x01 1
0010 0x02 2
0011 0x03 3
0100 0x04 4
0101 0x05 5
0110 0x06 6
0111 0x07 7
1000 0x08 8
1001 0x09 9
1010 0x0A 10
1011 0x0B 11
1100 0x0C 12
1101 0x0D 13
1110 0x0E 14
1111 0x0F 15

Although we have 16 combinations, only 4 are used by the code. Here is how these pins are internally used:

MOV DPTR, #L1E80             ;137C 90 1E 80
ACALL L1510_2D_MAP_ACCESS    ;137F B1 10      main advance table lookup
MOV R0, A                    ;1381 F8         result from lookup stored to R0

MOV A, P4                    ;1382 E5 E8      read port P4 
NOP                          ;1384 00         sync
SWAP A                       ;1385 C4         swap byte nibbles
ANL A, #0x03                 ;1386 54 03      leave only first 2 bits

MOV DPTR, #L1FF8             ;1388 90 1F F8   selector pin table
MOVC A,@A+DPTR               ;138B 93         lookup from the table using selector pin combination as index

ADD A, R0                    ;138C 28         add to the result from main advance lookup
MOV R0, #0x84                ;138D 78 84      
MOV @R0, A                   ;138F F6         store to RAM result for later use

The table at 0x1FF8 is indeed only 4 elements long and contains this:

index hex value signed decimal value
0 0x00 0
1 0x08 8
2 0x10 16
3 0xF8 -8

So, to the main advance table lookup result is added the value from this table and
it statically addvances or retards the whole map by this value. Each digit changes advance by 0.375 degrees,
so 8*0.375 is 3 degrees, 16*0.375 is 6 degrees and -8*0.375 is -3 degrees deviation from the map lookup

This map can be relocated and extended to it's full 16 elements length. A rotary switch with 16 combinations
can be used to select different steps of advance or retard.

Pin 9 selector

The green marked pin (pin 9) function is unknown and it still have to be tested, but it is
taken into account in software so it should have some effect. Anyone wanted to try it?
Here is how it is connected internally to the CPU:

EZK pin 9

It is pulled down normally, so it needs some positive voltage to work. Either +5 or VBAT should work

Here is how it is referenced in the code:

Pin-9 related code
	JB P3.5, SKIP_STUFF     ;148E 20 B5 10  <--- normal flow. By applying +12 to pin 9 the code below is executed
	CLR A                   ;1491 E4
	MOV DPTR, #L1F65        ;1492 90 1F 65
	MOVC A,@A+DPTR          ;1495 93           #0xD3 at that loc.
	ADD A, 0x40             ;1496 25 40
	JNC L14A1               ;1498 50 07
	CLR A                   ;149A E4
	MOV DPTR, #L1F66        ;149B 90 1F 66    #0x80 at that loc.
	MOVC A,@A+DPTR          ;149E 93
	SJMP L14D1              ;149F 80 30

Online Users

45 online users

Last Visitors

  1. You