Click on our menu buttons immediately below to find MegaSquirt® information quickly:

Missing Tooth Trigger Wheel Decoder for MegaSquirt-II™/MicroSquirt®

Code version 2.6 or greater can be configured to use a missing tooth crank wheel for the tach input. The wheel must be of the form M-N, where M > N, and there is only one set of continuous missing teeth. Common OEM wheels are 36-1 (used with Ford's EDIS and others) and 60-2 (common on many makes). (For a custom 36-1 wheel, see:

The missing tooth code uses the teeth of the missing tooth crank wheel to create 'tach teeth'. That is, it creates a tach signal from a particular tooth, then skips a number of teeth before declaring another tooth a tach signal. This means that all the tach teeth must correspond to real teeth. For a four stroke cycle engine, this means that the total number of teeth, including missing ones, must be evenly divisible by ½ the number of cylinders (or by the number of cylinders for a 2-stroke).

In later versions of the code (2.883+), the 'tach teeth' are still created for injection events, etc., but instead of the ignition timing advance signal being based entirely on the time after the last tach tooth (with intervening teeth ignored), the timing is set by the counting number of teeth, with only the amount between the last tooth and the desired timing estimated.

For example, if the engine had a 36-1 wheel, and 4 ignition events per revolution (i.e., a V8 with 90° intervals), then if this desired timing was 36° BTDC, the calculation would look like:

timing calc
= int*[(90°-36°)/90° × (36 teeth/ 4 events)] + (mod**[(90°-36°)/90° × 9 teeth/event] × last individual tooth interval)***
= int[54°/90° × 9 teeth/event] + (mod[54°/90° × 9 teeth/event] × last tooth interval)
= int[5.4] + (0.4 teeth × last tooth interval)
= 5 teeth + (0.4 × last individual tooth interval)
old code:
timing calc
= [(90°-36°)/90°] × last tach tooth interval***
= 54°/90° × last tach tooth interval
= 0.60 × last tach tooth interval
* 'int[...]' means truncate to in integer ("whole number"),
** 'mod[...]' (short for 'modulus') means take the remainder after dividing (i.e., the fractional portion),
*** interval adjusted for α, β, γ prediction results.

The net result is that the new code estimates the timing interval over a much shorter period (1 tooth versus 9 teeth in the above example), making it more accurate.

To set the Trigger wheel settings, go to 'Settings/Trigger Wheel Settings' in MegaTune. There you will find:

The trigger offset is 0, if that tooth lies up perfectly with the sensor at TDC.

The best way to think about this is the delay teeth is the 'coarse' setting, and the trigger offset is for fine adjustment (less than one tooth) to account for minor sensor misalignment. If the sensor is misaligned by more then one tooth, the number of delay teeth should be changed, and the trigger offset used to calibrate the advance as seen on a timing light with that seen in MegaTune.

For another example, with a 60-2 wheel, you would have for settings:

Note that you should change these parameters only with the engine OFF (or the stim rpm at no more than 300 rpm).

The missing tooth wheel decoder has been tested up to at least 18000 rpm for 36-1 and 60-2 wheels (yes, 18 thousand rpm) on the bench, and works fine.

For testing the missing tooth decoder on the bench, you may wish to use the crank wheel pulser. There is information on that here: crank wheel pulser.

Note that you must get the sensor polarity correct for the missing tooth code. This is even more important than with regular triggers, because if you get the signal polarity reversed you will get two (½n+1)*t missing tooth 'gaps', instead of the desired one (n+1)*t gap (and the engine might not run at all).

The blue line is the VR sensor output, the red line is the output from the VR input circuit to the processor.

Note that the VR circuit used in MicroSquirt® and the MS-II/Sequencer controllers performs an additional inversion on the VR signal before passing it to the processor. The net result is that you have to use the opposite edge to trigger off, compared to a MS-II controller with the V3 main board. So where MS-II uses 'rising edge', you would use 'falling edge' with MicroSquirt® or the MS-II/Sequencer, and vice-versa.

In this case, an input capture setting of 'rising edge' is correct ('falling edge' for MicroSquirt/MS-II Sequencer).

The proper polarity will depend on the way you wire your VR sensor (swapping the two leads to DB37 pin 24 and ground inverts the signal as seen by the VR input circuit), as well as your input capture setting. You may have to experiment to get them right if you don't have an oscilloscope.

In the code are two input variables to control the interrupt masking to prevent false triggers:

  1. Time Mask, (ICISR_tmask) time (msx10) after tach input capture during which further interrupts are inhibited to mask coil ring or VR noise, and
  2. Percentage Mask, (ICISR_pmask) percentage of the predicted interval before the next tooth (dtpred) after tach input capture during which further interrupts are inhibited to mask coil ring or VR sensor noise.
These are called the time mask and percentage mask, respectively, in the ignition options dialog of MegaTune. For wheel decoding you must use values close to 0.2 ms and 10%. However, to not break any existing setups, the default values are 0 and 50%, the same values hardwired into pre-v2.5 code. Be sure to adjust these values when you set up for a trigger wheel (note that they are in a separate dialog from the trigger wheel settings).

In addition to the above settings, you should set:

These are not needed because the teeth are much closer together than 1 signal/cylinder, and having them enabled only adds to the processor overhead.

If you wish to bench test the trigger wheel operation, you can use the crank wheel pulser program. Find out more here.

MegaSquirt® and MicroSquirt® controllers are experimental devices intended for educational purposes.
MegaSquirt® and MicroSquirt® controllers are not for sale or use on pollution controlled vehicles. Check the laws that apply in your locality to determine if using a MegaSquirt® or MicroSquirt® controller is legal for your application.
©2006, 2008 Bruce Bowling and Al Grippo. All rights reserved. MegaSquirt® and MicroSquirt® are registered trademarks. This document is solely for the support of MegaSquirt® boards from Bowling and Grippo.