To: Megasquirt List yahoogroups.com> From: Perry Harrington apsoft.com> Date: Mon, 22 Apr 2002 17:34:36 -0700 Subject: [megasquirt] Code to implement Ford EDIS ignition with current MS Here is some code I wrote to interface with the EDIS. It is sort of crude, but it should work. Here are the limitations: - It has 4 degree advance resolution (limited by timer resolution of 100us) - It has only 16 bins for advance (my imposed limitation, it's changable in the header) - It has 200rpm advance increment resolution (unsigned binary limitation) - It starts the table at 400rpm (header file changable) It controls advance from 400 to 3600 rpm in 200 rpm increments, most engines are at full advance by 3600 anyway. The bin numbers are derived by the PCC, they are the number of timer ticks to leave the SAW high; 0 to 15 cycles. The number of ticks is inverse to advance, 15 ticks is minimum advance (base + 3.90625 = 13.90625 degrees) and 1 tick is max advance (base + 58.59375), 0 is base which is 10BTDC. The 0 bin of the advance should be 0, that is 10 degrees BTDC and the base advance The IGN_ADV_FIRE subroutine should be called from the tach input interrupt (after buffering). The IGN_ADV_KILL subroutine should be called from the timer interrupt, or embedded inline Basically, the code sets Port A, 2 high (the saw pin on the edis) in the tach input interrupt. The saw pin is then lowered in the timer int when our delay counter runs out; the delay counter should be initialized to 0 at boot up. The method below has an error of 4 degrees, because there is no sync up between the tach int and the timer int, so as soon as the tach int finishes, the timer int can shut off the SAW. This means if you desire 14 degrees timing, you could get 14-18 degrees because shorter pulses are more advance. If this bothers you, you could simply add 1 to the ign_delay, which would err in less advance vs more advance. This code is intended to be a proof of concept, that you CAN crudely control the EDIS with a 40 pin GP32, however there are caveats. --Perry