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


MegaShift™ V5 Settings

V5.1xx MegaShift™ code is the latest release code for controlling automatic transmissions using the GPIO board form Bowling and Grippo. This code has:

Jump to the: Set-Up and Tuning Parameters.

The Windows 9x/ME/XP/Vista software applications you use to tune and configure your MegaShift™ hardware are called TunerStudio by Phil Tobin. You also need a laptop or notebook computer and a conventional serial port (or USB-serial adapter) to communicate with MegaShift™.

CANbus Pass-Through

To set up TunerStudio to use MShift™ with CANbus from MS-II™:

  1. First set the MS-II™ up normally under Project Properties (if you haven't already set up a controller for your engine controller):

    1. Give your project a name and description,
    2. Select the INI to match the firmware on your primary controller (MS-II™, MicroSquirt®, Sequencer™, etc.). You can either:
      • use a 'pre-defined' firmware from the drop-down list, or
      • click 'Other' and browse to a specific INI file.
    3. Click "OK".

  2. This code INI has several Project Property Settings. You set/change them in TunerStudio under 'Project → Project Properties → Settings'. This is the first thing you should do after creating a new project. The settings are:

    Note: The way the code and INI handle metric conversions has changed from older (4.122 and earlier) codes. You MUST set your units before loading an old MSQ. When upgrading from older code, be sure to save the old user parameters in a MSQ, load the new code and set up the new INI, change your units (Project -> Project Properties -> Settings: CELSIUS and SI_LENGTHS) to what you used when creating the older MSQ before finally loading the old MSQ file. The defaults are for both settings to be deactivated (i.e. Imperial units). Otherwise the values will be converted again (i.e. twice, so they will be incorrect) when you change the units settings. Once the units are set, you don't have to worry about this anymore.

  3. Then set up the MShift™ GPIO controller under 'CAN devices' of the engine controller project:

    For example, if you have a Project that has an MS-II™ as the main controller you will connect the laptop to, and a GPIO board with MShift™ as a CANbus device with the CANbus ID set to 1 (the default), only GPIO board goes in CAN Devices list and the CAN ID should be set to 1.

    1. Device Identifier (short): Give your CANbus controller a short name. This will preface the menu entries as they drop down in TunerStudio so you always know which controller you are working with when you change parameters in the menus.

    2. Device description: This is a longer description to remind you of the configuration you are setting.

    3. Device CAN ID: The CANbus ID for the MShift™ code has a default value of 1. You can change the CANbus ID in the menus to a value up to 13 to avoid conflicts with other CANbus devices - if you do change the MShift™ CAN ID you must also change it to the same new value under 'File/Project Properties/CAN Devices'.

      However, to prevent people accidentally screwing up their comms, it is un-editable in the INI file until you make a small change. Use a text editor and find a line in the INI like:

      [pre]field = "!MS-II CANbus ID", ms2canID, { 0 } ; change to { 1 } to make editable[/pre]

      and change it to:

      [pre]field = "!MS-II CANbus ID", ms2canID, { 1} ; change to { 1 } to make editable[/pre]

    4. Device Configuration File: You will have to set the 'Device Configuration File' to point the GPIO.ini file for your MShift™ controller (you can download the file from the link for V4.100 code). Note that you can select another file at any time to update the INI (re-start TunerStudioMS to see the new INI), you don't have to remove the CANbus Device and then re-create it. If You are updating both the code and the INI, then you also have to reload the code on the MShift™ GPIO board using its serial connection, of course.

    5. Configuration Settings: Be sure to 'Activate' CAN_COMMANDS in the 'Configuration Setting' section of the CAN Devices dialog. This activates the use of CANbus pass-through mode for TunerStudio.

Here is a video on setting up CANbus in TunerStudioMS: CANbus set-up video (22 MBytes)

There is more on the CANbus pass-through here: www.msgpio.com/manuals/mshift/cpt.html, including assembly and wiring instructions, etc.

Set-Up and Tuning Parameters

The following is a list of of all the tuning parameters in the MShift™ V4.1xx software, and each has a description of how that parameter is used. Pressing F1 at any menu in the tuning software while connected to the internet will take you directly to the corresponding spot in this file.

Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

  • PWM Refresh and Dithering

    Some PWM solenoids uses a deliberately low PWM percent, but refresh the solenoid with a burst at 100% before it can close. As well, some pressure control solenoids use a cleaning pulse (called a 'dither') to ensure adequate fluid flow through the system to keep the system clean. You can set both of these up in this dialog.

  • ISS/non-CANbus Tach Settings

  • Error Behavior

  • Shift Input Patterns

    Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

  • Shift Output Patterns

    Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

  • TCC Settings

    TCC lock-up start values: The following values set the PWM% that the TCC will start at, it will then move to the 'PWM% when TCC Locked' over the 'PWM Taper Time' you specify. This allows you to have smooth engagement of the TCC Lock-up.

  • Tables

    Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

  • Load table TPS by RPM: TPS is always processed through a user-specified 6x6 TPSxRPM table before it is used (whether it is averaged with MAP or not).

    In general, you want to set the table cell values to to provide the most constant TPS that still reflects the driver's demand for torque. You can do this by restricting the range as various RPM's. For example, in the table below the lowest RPM adjusted TPS percentage (aTPS%) can only go from 10% to 55%, while the highest RPM aTPS% can only range from 50 to 100%.

    The TPS Load table can be used in a number of ways, so you may need to experiment with different approaches to find what works best for your application.

    If user really wants to use only TPS for load with no adjustments, they can set the table so the the cells in each TPS row are identical to the bin value for that row, then the output from the table will be the TPS, like this:

  • Bins

  • LED Patterns

    Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

    Here you can set the LED patterns in each gear. The default is:

    However, using these menu items, you can change the pattern in each gear. Select the gear you wish the change the pattern for from the menu, then change the pattern in the dialogue to have each LED "off" or "ON" for that gear.

    For example, you can have only one LED light in each gear. You can also set two patterns for reverse: the LEDs will cycle through the set patterns once per second - allowing you to have the display flash in reverse as a warning.

    Or if you wish to use a 7-segment LED to display the current gear numerically, you can use these pattern to adjust the 4 LED outputs to be suitable for a 7-segment LED driver (such as the 4511 7-segment decoder/display driver IC).

    Note that when driving LEDs, "ON" means current is allowed to flow, and "off" means current is not allowed to flow. If you are using a pull-up circuit with a 7-segment LED driver IC, "ON" will mean the pull-up voltage is held low (< 0.7 Volts), while "off" will mean the pull up voltage is high. So it might be backwards to what you expect (unless you are using the processor pins directly, in which case "ON" means 5V is being supplied).

    There is much more on using the 7 segment LED/LCD driver here: 7segment.html

  • Tuning

  • Tach + Load based Shifts

    When "Tach + Load Shifting" is enabled (under 'General Settings → Shift Factors → Auto Shift Mode') the VSS based shift table(s) are no longer used. Instead, there are a series of 'per gear' upshift and downshift engine RPM tables (with 8 elements each by load) under 'Tach + Load Shifts' on the main menu.

    These tables can be set in TunerStudio:

    The tables are either upshift or downshift tables:

    These tables set the RPM to shift at for each shift (based on the current short-term load average). For example, for a four speed transmission you would have:

    Current Gear Upshift Downshift
    1st 1-2 Upshift Table No downshift possible
    2nd 2-3 Upshift Table 2-1 Downshift Table
    3rd 3-4 Upshift Table 3-2 Downshift Table
    4th No Upshift possible 4-3 Downshift Table

    There is no downshift table in 1st, and no upshift table in 4th (for a 4-speed) obviously.

    The shifts work by first checking for an upshift (if the current RPM is greater than the interpolated RPM from the upshift table; if there is no upshift required then the downshift RPM is checked against the downshift table. The shift bring different upshift and downshift tables into play (those for the next higher gear if there was an upshift, and for the next lower gear if there was a downshift).

    Some care must be taken to ensure that an upshift from a gear (say 2nd) will not be followed by an immediate downshift in the target gear (3rd). This will happen if the ratio of the gear ratios (3rd/2nd or 1.000/1.630 = 0.613 for a 4L60e) multiplied by the current rpm in 2nd is lower than the downshift rpm for the target gear. If the shifts start oscillating, that likely means that this situation has been encountered, and the upshift rpm must be raised, the next higher gear's downshift rpm must be lowered, or both.

    And a similar situation applies for downshifts followed by immediate upshifts (in which case the downshift rpm for the current gear must be lowered, the upshift rpm for the next lower gear must be raised, or both).

    Any short-term load below the user specified lowest load bin value for the Tach-based shift table is treated as if the load were equal to the lowest load bin (i.e. the rpm in the lowest cell will be used for shifting), and any short-term load average that is above the highest load bin will use the highest bin's rpm value for shifting. For example, in the above illustration, the highest bin is 6000 rpm at 100 kPa. So 6000 rpm would be the shift point for any load over 100 kPa as well, even if it were 250 kPa or more.

  • RPM × Load Up/Down Shift Tables

  • Spare Ports

    Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

    Spare Port Function: The function of each three 'spare ports' can be selected under: Spare Ports→Spare Ports Function→Spare Port X Usage (there are 5 modes, corresponding to 5 values of the parameter spX_mode):

    1. User Spare Ports/Speedo Output*:

      • Spare Port 0 Use: For spare port 0 (but not spare port 1 or spare port 2 or spare port 3), the user can select to enable this output to send a signal to an electronic speedometer. The output will then put out a pulse/mile signal (based on the VSS input) of the user's choice. To set this up, set the function to 'Speedo Output' under 'Spare Ports→Spare Port Function' and then set the desired pulse/mile under 'Spare Port→Speedo Output on Spare Port 0':

        • Output pulse/mile: This is the output pulses/ mile (or pulses/kilometer if you have set Metric units) for the speedometer output. The output is triggered in the VSS tooth interrupt (not the main loop), and has to be at least 2 of these long (one tooth to turn on, next tooth to turn off, etc.). As long as the ratio of speedometer output to VSS input is reasonable (say 1:5 or 'higher') it will work fine. Typically, the VSS gives about 96000 pulses per mile and the speedometer will require 2000 to 4000 pulse/mile. This is a VSS/speedo pulse ratio of 24:1 to 48:1; well within the range needed to work effectively with your MShift™/GPIO controller. This output is used to drive an electronic speedometer (such as those found on many newer vehicles) - it is adjusted automatically when you change the VSS settings (such as tire diameter, rear axle ratio, etc.). The output is a 0-12V square wave.

          The speedometer output signal will adjust automatically after a reset when you change the tire size, final drive ratio, or number of VSS teeth. If not used as a speedo output, this is a PWM enabled port with a 16x9 lookup table.

          You can use the calculator above to determine the ratio of the VSS input frequency (pulse/mile) to the speedo desired output.

        • Speedo Output Duty Cycle: You can use this parameter to set the pulse width modulation percentage for the speedometer output signal. It can be set from 1% to 99%, where the percentage is the time 'high' when the signal from the processor is used to control a PNP transistor with a pull-up circuit (i.e. the standard build). This can help in making the speedo output signal compatible with some speedometers. The default is 50%.
      • Spare Port 1 Use: For Spare port 1 and spare port 2 (but not spare port 0 or spare port 3), the user can select settings to control the behavior based on speed, rpm, load. ON and OFF PWM percentages are based on the 12 element table (ON) and PWM OFF value (OFF). The PWM is updated continuously based on the index value. The AND'ed conditions, thresholds, and hysteresis values are set under: Spare Ports→User Spare Port X.

        There are four 'user spare ports' spare ports 0, 1, 2, and 3. Spare port and spare port 2 can use an ANDed combination of speed, rpm, load, and current gear (with hysteresis). Assuming they are not used for another function (like a 4th shift solenoid), these can be used to control external devices like fans (ex. shut off above a specified speed), or ancillary trans functions.

        These are the 4 conditions on 4 variables (vehicle speed, engine rpm, load, and current gear) that can be used to set the state of the spare port output on Ampseal pin 11. The conditions are:

        • 'no condition': this is ignored, so if you don't want to use 4 conditions, you don't have to. Just leave the unwanted variables as 'no condition'.
        • 'greater than or equal to'
        • 'less than or equal to'
        Note that the port is not directly aligned with the circuit on the 25x2 header. To use spare port 1, you must jumper from PT7 to VB1 (they are near opposite corners of the 25x2 header).

        For example, if you set:

        • condition to 'greater than or equal to',
        • speed to 50, and
        • hysteresis to 5
        and have 'no condition' on the remaining variables, then Output1 will go high when the speed reaches 50 (either mph or kph depending on what you have your units set to), and won't go low until the speed drops below 45.

      • Spare Port 2 Use:

        You can set up to 4 of the following conditions. There are 4 conditions on 4 variables (vehicle speed, engine rpm, load, and current gear) that can be used to set the state of the spare port output on Ampseal pin 12. ALL must be 'true' for the output to switch. The conditions are:

        • 'no condition': this is ignored, so if you don't want to use 4 conditions, you don't have to. Just leave the unwanted variables as 'no condition'.
        • 'greater than or equal to'
        • 'less than or equal to'
        Note that the port is directly aligned with the circuit on the 25x2 header. To use spare port 2, you just jumper from PA0 to VB2.

        For example, if you set:

        • condition to 'less than or equal to',
        • speed to 50, and
        • hysteresis to 5
        and have 'no condition' on the remaining variables, then Output2 will go high until the speed reaches 50 (either mph or kph depending on what you have your units set to), and will stay low until the speed drops below 45.

      • Spare Port 3 Use: For spare port 3 (but not spare port 0 or spare port 1 or spare port 2), the user can select to enable this output to be as a dedicated line pressure control. When used as a dedicated line pressure output, the PWM percentage will be derived from 16x9 Pressure Control Table, unless the pressure exceeds the up/downshift limit pressure for that shift, or if the RPM is less than 300 RPM (in which case it is set to 100% pressure = 0% PWM). However, when spare port 3 is used in any other mode (PWM Mode, TCC Mode, Use as Shift Solenoid, or Selective Clutch Mode) the 16x9 spare port 3 PWM table is used instead of the line pressure table.

        Note that:

        • The line pressure table is 100-PWM%, while the spare port 3 table is PWM%, so for example a value of 75% in the line pressure table would be the same as a value of 25% (100-75) in the spare port table.
        • The tables and bins for the line pressure table and the spare port 3 PWM table are independent,
        • You can switch between spare port 3's line pressure and PWM modes without affecting the PWM percent values in either. The tables, bins, and parameters will not be transferred by TunerStudio between the two when you switch modes, however
        • The period setting (=1/frequency) is shared between the line pressure and other modes, so if you change it in one mode, it will remain changed if you switch modes.

    2. PWM mode: For spare port 0 or 3: Use the only PWM 144 element (16x9) table and OFF value to set the state. This setting relies on the 'PWM active' parameter (below) to determine when the PWM state is ON or OFF. The PWM can be set to a range of values from 0% to 100% in 144 bins (and the user can select if the interpolated PWM percent varies with load, temperature, speed, or engine rpm. The user can also set a single separate OFF value for the PWM. If the user doesn't want varying PWM, and wants and ON/OFF output instead, they can simply set all the table values to 100% and the OFF value to 0% (or vice-versa).

      For spare port 1 and spare port 2: Use the only PWM 12 element table and OFF value to set the state. This setting relies on the 'PWM active' parameter (below) to determine when the PWM state is ON or OFF. The PWM can be set to a range of values from 0% to 100% in 12 bins (and the user can select if the interpolated PWM percent varies with load, temperature, speed, or engine rpm. The user can also set a single separate OFF value for the PWM. If the user doesn't want varying PWM, and wants and ON/OFF output instead, they can simply set all the table values to 100% and the OFF value to 0% (or vice-versa).

      Spare Ports→Spare Port X PWM Setup→PWM Active (spX_active):

      • PWM Active: In PWM mode, the user has 3 choices as to when the PWM table is used:
        1. always ON: PWM percent is always based on the 12 element table, whether shifting or not. The OFF value is not used.
        2. ON except while shifting: PWM percent is based on 12 element table, except during shifting when it is set to the user specified OFF value.
        3. ON only during shift*: PWM percent is based on 12 element table during shifting, but when not shifting the PWM percent is set to the user specified OFF value. (This is the inverse of the previous mode.)
        * = default value; X = 0,1,2,3

      • PWM Index: The pulse width modulation uses a table lookup for the ON state and has an OFF value as well as index options. For spare port 1 and 2, the user can select the index value to use ('Spare Ports→Spare Port X PWM Setup→PWM Index') to interpolate the 12 element PWM% table based on the bins in the 'Spare Ports→Spare Port X PWM Index' table. For spare port 0, the user can select the index values to use ('Spare Ports→Spare Port X PWM Setup→PWM Index') to interpolate the 144 element PWM% 2-D table based on the bins in the 'Spare Ports→Spare Port X PWM Index' table. The possible index values are:
        1. Load*,
        2. Speed,
        3. RPM,
        4. Temperature (only positive temperatures are allowed).
        5. Current Gear (only positive gears allowed, i.e. neutral/park through 8th)
        6. MAP
        7. TPS
        8. Aux Volts (x100) ("x100" means that you would enter a value of 325 in the index bin for 3.25 Volts, 189 for 1.89V, etc.) Aux volts (x100) can be used at any time, regardless on whether you have CAN enabled or not.
        * = default value; X = 0,1,2,3

      • PWM Period: This is the period of the pulse width modulation. The period = 1/frequency. The PWM clock operates in 0.128 millisecond 'ticks'. The period can be from 30.6 Hertz (cycles per second) to 1953 Hertz. You can enter any value you like, but the tuning software will round this to a multiple of 0.128 milliseconds.

      • PWM% when inactive: This is the desired PWM percentage when the spare port is in the OFF state. It can be set to 0 (actually off), or any other value up to 100% (it will be rounded as necessary).

      For spare port 1 and 2 there are two 12x1 tables for each spare port's PWM. One (Spare Port X PWM Percent) sets the percentage of 'ON-time' for each bin of the index table. The index table is used to compare the current 'PWM Index' value (which can be the current load, speed, temperature or rpm, depending on what you have selected in the PWM setup) to the index bin values. The code finds the closest bin values in the index table, and then computes the interpolated PWM% from the 'PWM percent' table. Dealing with two separate table is awkward, though. Instead, it may be easier to use the 'Tuning→Spare Port X (index)' graphical presentation. This gives a graph of the index versus PWM%, along with the associate tables, all in one place.

      For spare port 0 and spare port 3 there is a two index table for each spare port (a 9 element bin table for the y axis, and a 16 element bin table for the x axis). These are used to interpolate the PWM percentage from a 144 element table. The bin values and PWM table can be edited under 'Tables→Spare Port X Table' once the spare port is set to a PWM enabled usage under 'Spare Ports→Spare Port Function→Spare Port 0 Use' (i.e. if it is not set to be a speedo output).

      PWM mode for Spare Port 3 is a bit different than for the other spare ports. Spare port 3 can be used in PWM mode as a alternate algorithm for the line pressure output. The PWM will be derived from spare port 3's 16x9 PWM table (not the 16x9 load × speed line pressure table), unless:

      1. Shift PWM Option is set to:
        • 'Use OFF value', then the fixed OFF valued specified for spare port 3 will be used during shifts, OR
        • 'Use shift limits', then the higher PWM value (i.e. lower pressure for a bleed valve) of the table or (100 - maximum line pressure upshift/downshift) setting will be used (see: www.msgpio.com/manuals/mshift/V5tune.html#gl)
      2. If the Spare Port 3 'Table Active' value is set to 'ON if RPM > 300, else OFF' then the PWM will be set to the OFF value when the engine RPM is less than 300 (i.e. if not running or cranking). This setting can reduce current draw when not running if set to 0%, and can reduce the electrical noise associated with pulse width modulating the pressure control valve.

      Note that the PWM reported in TunerStudio is the actual PWM percentage. As the frequency increases, the 'granularity' of the possible PWM% increases, and the PWM% may be off from the target by up to several percent. Lowering the PWM frequency (increasing the period) will result in better accuracy.

    3. TCC mode: Output is ON (PWM% from 12x1 table for sp1/2, from the 16x9 table for sp0) while TCC is engaged, OFF otherwise. None of the spare port TCC settings affect the main TCC output on PT3 (which has its own PWM frequency, PWM algorithm, etc.)

    4. Use as Shift Solenoid: Output state is changed at some shifts based on user's output pattern. PWM% from 12x1 table in ON state. Note that if you want to have a constant PWM% for the shift solenoid, you should enter that value in all 12 bins (sp1 & sp2) or 144 (sp0) of the spare output's PWM % table.

    5. Selective Clutch: This parameter is to select using as ports active only during shifts (i.e. 'clutch' outputs), which are active only during the shifts specified under 'Shift Output Patterns→Clutch Pattern (Output 4/7)'. The ON state PWM percent is set by the 12x1 table for spare port 1 and spare port 2. The ON state PWM percent is set by the 16x9 table for spare port 0.

      In 5.102+ code, the selective clutch outputs on spare port 1 and spare port 2 can be set to engage momentarily when the TCC engages (called 'TCC follow mode'), as well as when certain up/down shifts occur. This is a useful function for some VW/Audi transmissions. You set the user parameters under 'Shift Ouptut Patterns → Clutch TCC Activation'. The settings are:

      • Activation Period: Time duration keep the spare output activated after the TCC engages. The value can range from 0.00 to 2.50 seconds in 0.01 second steps; the default is 1.00 second, and
      • SPX with TCC in Gear X: In each current gear there is a choice to 'Don't apply SP1 [or SP2] with TCC in X Gear' (the default for all gears) OR 'Apply SP1 [or SP2] with TCC in X Gear'.

    6. Gear Indicator: (for spare port 2 only) This mode lets the user set an independent PWM percent and period for each gear (PNR1234...8). In gear indicator mode, the PWM tables are not used at all for spare port 2. Instead you can directly enter the PWM percentage and/or the desired frequency (=1000/period (msec)) for each gear in the menus described below. This allows all of the function of a 1D PWM table with a gear lookup, except it also allows: variable frequencies between gears, negative gears, and the code can differentiate between neutral and park.

      The PWM frequency and percentage are set in two menus:

      1. Spare Port 2 Gear Mode Duty Cycle: Here you can set the pulse width modulation duty cycle in each gear (either the current gear or the manual gear lever position, with either including PNR) from 0 to 100% in 1% steps. Note that the PWM percentage is the percent of time 'high' at the processor pin. Whether this is high for your device depends on the driving circuit and the device itself. In some case the PWM% can be inverted by the particular circuit's layout and components, so use caution in implementing this control (you may need to set the value to 100% minus your desired percentage). For example, with the default VB2 open-collector circuit's NPN TIP120 transistor, if you are:

        1. Driving a device (such as a solenoid, LED, or motor) by sinking a current flow; current will flow through the NPN transistor when the processor pin is high, so the PWM percentage will represent the amount of time current is allowed to flow (so 100% means full current, 50% means ½ current, and 0% means no current at all).

        2. Generating an external signal (such as for a tachometer to use as a gear indicator) using a pull-up circuit* (with a resistor) on the NPN transistor's collector (ex. TIP120), then the output at the ampseal pin signal voltage will be:
          • High when the processor pin is low, and the pull-up voltage raises the signal voltage because the transistor is not flowing,
          • Low when the processor pin is high and the transistor is flowing, because the pull-up voltage, and thus the signal, is grounded through the transistor.
          In this case, a duty cycle value of 100% will result in a signal that is always low, a duty cycle value of 0% will result in a signal that is always high, and for example a duty cycle value of 33% will result in a signal that is high 67% of the time. So the signal is inverted in this case, and you need to be aware of this when setting the duty cycle values.

        Note that higher frequencies will have less resolution on the PWM percentage, and the user input PWM percentage value will be rounded up or down as required by the controller. Lower frequencies mean the PWM percent will likely be closer to the user-set value (for example, a period value of 12.8 milliseconds (78 Hertz) will give at least 2% accuracy for the PWM percentage, while a period value of 1.28 msec (781 Hertz) will give a potential error of up to 20%). At the highest frequencies (lowest period), setting the PWM percent to 25%, 50% or 75% will give the best results.

        * A pull-up circuit is comprised of a current-limiting resistor that connects the signal to a voltage supply. The current limiting resistor is chosen to limit the current draw when the driving transistor is flowing (otherwise the voltage supply would essentially be shorted to ground). Resistor values of 1k Ohm (1000 Ohms) to 10k Ohm (10000 Ohm) are commonly used for signaling purposes for automotive devices. The voltage supply is typically either the vehicle's 12V (nominal) supply, or the controller's 5V supply, depending on how much voltage the signalled device requires.

      2. Spare Port 2 Gear Mode Period: The periods can be from 0.512 millisecond to 819.1 milliseconds (for frequencies from 1.2 Hertz to 1953 Hertz). Here you can set:
        • Whether to use the current gear that the transmission is in or the manual gear lever position to look-up the PWM duty cycle and frequency on spare port 2. The default is 'Use Current Gear' and the other option is 'Use Manual Lever Position'.
        • The pulse width modulation period in each gear (including PNR) from 0.512 milliseconds (1953 Hertz) to 819.1 milliseconds (1.22 Hertz) in 0.0128 millisecond steps (TunerStudio will automatically round entered values to multiple of 0.128 as required). The output frequency is the inverse of the period value entered (i.e. when the period value is in milliseconds the resulting frequency will be freq = 1000/period).

        Example: Tachometer as a Gear Indicator

        This frequency output function could be used to drive a tachometer as a gear indicator, for example. To use this, recall that for an N cylinder 4-stroke cycle engine (N = 1,2,3,4,5,6,8,...) there is one spark event every second revolution, so the frequency is:

        frequency = sparks/sec = (RPM revs/min) * (1 min/60 sec) * (1 spark/cyl/2 revolutions) * N cyls
        i.e., frequency = RPM * N / 120
        and the period is:

        period = 1/frequency = 120/(RPM*N)

        For example, this is RPM/15 for an 8 cylinder, 4-stroke cycle engine, RPM/20 for a 6-cylinder, and RPM/30 for a 4 cylinder engine. To get a four stroke cylinder tachometer to indicate 2000 rpm (often abbreviated to just a "2" on the tach face, implying 2nd gear), we would set the period to:

        period = 120/(2000 * 4) = 0.015 seconds = 15 milliseconds which rounds to 14.976 milliseconds in the code.

        Here is a calculator to do the math for you:

        Tach setup for →→→
        Cylinders
        Strokes/Cycle
         
        Park/Neutral
        (= 0 rpm)
        (set PWM % to zero)
        1st
        (= 1000 rpm)
        2nd
        (= 2000 rpm)
        3rd
        (= 3000 rpm)
        4th
        (= 4000 rpm)
        5th
        (= 5000 rpm)
        6th
        (= 6000 rpm)
        Target
        Frequency:
        Hz Hz Hz Hz Hz Hz Hz
        Rounded
        Period:
        milliseconds milliseconds milliseconds milliseconds milliseconds milliseconds milliseconds

        You may decide to re-label the tach values, especially if the tach allows access to the face so you can replace it with a computer drawn custom face with PNR plus all your forward gears (in which case you can use whatever periods that work with your design, of course).

  • Communications

    Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

  • Tools

    Note: DO NOT power off the MShift™/GPIO board while the 'Flash Burn' indicator is active. Doing so *will* corrupt your settings. Wait a second or two for the burn to complete before powering down the board.

  • Help


    1 'Bit banging' means the port is turned off and on by specific instructions in the code that occur within normal program flow. In MShift™ code, the opportunity to turn these outputs off and on occurs every 1/8th of a millisecond.
    The alternative method to switch the outputs on and off repeatedly is to use timer channels. These are built in processor hardware devices that allows the user to set the PWM frequency and duty cycle, and the hardware handles the PWM switching independently of the program code. This not only reduces computational overhead, but can be switched an much higher (or lower speeds) and is also is much more accurate.
    There is more information on bit-banging with MShift™ code here: www.msgpio.com/manuals/mshift/bit_bang.html


    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.
    © 2011, 2016 Bruce Bowling and Al Grippo. All rights reserved.