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


                    
MegaManual Index -- Embedded Software Upgrade Instructions -- MegaSquirt Glossary -- MegaSquirt Schematics
MegaSquirt 68HC908GP32 Memory Map -- Some MegaSquirt® Assembly Language Variables
MegaSquirt MC68HC908GP32 Instruction Set -- Programming a Blank Processor

MegaManual Appendices

This manual contain the following appendices:


Embedded Software Upgrade Instructions

You can use Hyperterm, download.exe, or EasyTherm to upgrade your embedded software. Each is described below.

Hyperterminal

Here are instructions for using Hyperterm.exe for updating the embedded software (all Windows installations has the Hyperterminal application - use a "find-file" function to search for "hyperterm.exe"):

1) Remove the power from MegaSquirt.

2) Put a bootloader jumper pin (a bent piece of snipped off lead from a resistor, etc. will work fine - bend it into a U shape) across the two holes labeled "boot" on the V2.2 PCB (short R6 for V1.01 boards),

3) Hook-up a serial cable from the computer to the MegaSquirt® box and fire up Hyperterminal (Hyperterm.exe).

Note: you do not use the MegaTune to perform the firmware upload - this is done with the terminal program Hyperterm (or similar, see below), and do not have MegaTune, or any other serial data application running on your PC. At this point, leave the MegaSquirt unit unpowered.

4) You will see a Hyperterminal screen when you execute - type in any name you want in the box, and make sure the Red telephone with the little yellow telephone next to it is highlighted.

5) A new window appears. On the "Connect Using" selection, select either COM1 or COM2, depending on your serial connection.

6) Then another window with comm port settings pops up. Select 9600 baud, 8 data bits, no parity, 1 stop bit, and set flow control to "None"; - this is very important. Hyperterm terminal is now up.

7) Apply power to MegaSquirt® EFI Controller, then hit <Enter>. You should see the "Boot>" prompt appear in the terminal screen.

8) Type "H" and you will be shown the options available in bootloader mode.

9) Hit "W" for "Wipe" - this erases the entire flash array (except the section running the bootloader).

10) Hit "U" for "Upgrade," which will respond with the text "wait ...".

11) Then under the "Transfer" menu, select "Send Text File..." (do not use the "Send file" mode - you are sending a text file).

12) Set "Files of type" to "All files" and select the .s19 file containing your assembled code (megasquirt.s19). You will see no activity on the screen for about 40 seconds.

13) Then the prompt will come back, which means the operation is finished.

14) Turn off power to MegaSquirt® and shut down Hyperterminal.

15) Remove the jumper, and you are ready to go.

Downloader

OR if you would rather use something simpler than Hyperterminal,

To use the downloader, you:

1) Turn off the power to MegaSquirt® (remove the stim).

2) Dowload the .s19 file you want to use, and save it on your hard drive, say on the desktop.

3) Get the downloader file by clicking the link. Save ms2dl200_setup.exe wherever you saved the .s19 file (desktop).

4) Navigate in Windows to the directory (desktop) containing ms2dl200_setup.exe and the .s19 file. Double-click on the ms2dl200_setup file, and follow the prompts to install the downloader on your computer.(Be sure to click 'Run' at the 'publisher could not be verified' warning.) The setup will install the downloader in the 'C:\Program Files\MegaSquirt folder', and create a shortcut in the Start menu, and an icon on the desktop. Delete the ms2dl200_setup.exe setup file.

5) Put in the H1 jumper, (or short out R6),

6) Power up the MegaSquirt

7) Double click on the 'MS-II Download 104' icon on your desktop. The program will open with a blank screen.

8) Under 'File/Settings' set the com port you use to connect to MegaSquirt® EFI Controller, and the connection speed (9600 for MS-I, 115200 for MS-II)

9) 'File/Open' the .S19 file you saved earlier (the desktop, or whenever else you saved it). The download will begin automatically.

10) Watch it report status as the download proceeds (depending on the level of 'verbosity' you have chosen). Watch for a line that tells you 'verification succeeded', and you are done.

11) Pull the jumper off R6 (or the boot jumper), cycle the power to MegaSquirt® (turn it off and on), and start tuning.

EasyTherm

OR simpler yet,

Use EasyTherm. It includes the most recent embedded software versions for MegaSquirt. Note that the default values in EasyTherm are for the recommended General Motors sensors. To use EasyTherm:

  1. Connect your MegaSquirt® to your PC,
  2. Short the boot jumper,
  3. Power up MegaSquirt® with at least a 12 volt supply,
  4. Launch EasyTherm,
  5. Pick the COM port you use to communicate with MegaSquirt® EFI Controller,
  6. Select the code type, or pick the 'Custom' option for any .s19 file not shown in the list,
  7. Click 'Download' Button,
  8. When prompted (for the 'Custom option'), browse to the .s19 file you would like to download,
  9. Click 'OK' and the download process begins.

When you are done, remove the power to MegaSquirt® EFI Controller, and remove the boot jumper.


MegaSquirt Glossary

Also check the Some MegaSquirt® Assembly Language Variables in this section.

ADC - stands for "analog-digital converter". In this case, it is part of the conversion circuitry in the CPU that translates the varying voltage TPS signal to a digital signal that the CPU can understand and operate on. All of the sensors (TPS, MAP, CLT, IAT) send their signal to a particular ADC on the processor.

AE - Acceleration Enrichment, the enriched mixture provided when the throttle position sensor signal changes at various rates.

AFR - Air Fuel Ratio, the mass ratio of air to fuel in the combustion chamber. See NB- and WB-EGO sensors, below.

ASE - After Start Enrichment, the enriched mixture provided for a number of engine cycles when MegaSquirt® detects that the engine has transitioned from cranking to running.

ASE - After Start Enrichment, the enriched mixture provided when engine has just been started.

ATDC - After Top Dead Center, the crankshaft position with respect to the piston being at the top of its travel, meaning it has passed it's highest position and is descending.

BTDC - Before Top Dead Center, the crankshaft position with respect to the piston being at the top of its travel, meaning it has NOT passed it's highest position and is rising. Most normal spark event occur BTDC.

CAN - (Controller Area Network) - a dedicated automotive networking system to allow different automotive processor to communicate and share inputs and calculated results. Used for MegaSquirt-II and the GPIO board, router board, etc..

Closed loop - refers to those times when an EFI computer is using the feedback on the mixture provided by the oxygen sensor to effectively control the injected amounts.

CLT - CooLant Temperature sensor (aka. CTS). Usually the CLT sensor is an NTC (Negative Temperature Coefficient) thermistor, or a resistor whose resistance varies with temperature (NTC means the resistance goes down as the temperature goes up.

CPU - Central Proccessing Unit, aka. "processor" the computational engine that performs the calculations to operate the injection and ignition function in MegaSquirt. It has a number of support circuits, like the power circuit, the clock circuit, the serial and CAN communications circuits, and various input and output conditioning circuits.

CTS - Coolant Temperature Sensor (aka. CLT). Usually the CTS is an NTC (Negative Temperature Coefficient) thermistor, or a resistor whose resistance varies with temperature (NTC means the resistance goes down as the temperature goes up.

DMM (digital multi meter) electronic current/resistance/potential measuring tool.

DT (dual table) the dual table embedded code that has a number of additional features over the standard B&G embedded code.

Duty Cycle (DC)– A number indicating the amount of time that some signal is at full power. In the context of MegaSquirt® EFI Controller, duty cycle is used to describe the amount of time that the injectors are on, and to describe the “hold” part of the peak and hold injector drivers (see Low Impedance Injectors, below).

EasyTherm (ET) - A Windows program that simplifies configuring your MegaSquirt® to accept the substitution of non-standard temperature sensors and to upload software revisions.

ECU - (Electronic Control Unit) is the general term for a fuel injection controller, of which MegaSquirt® is an example.

EDIS - Electronic Distributorless Ignition System is Ford's wasted-spark computer-controlled ignition module, which has been made to work with modified versions of MegaSquirt.

EGO Sensor - Exhaust Gas Oxygen sensor, used to describe the sensor in the exhaust that measures the lean/rich state of the AFR. Used to control the via a feedback algorithm called “closed loop”.

EGT (Exhaust Gas Temperature) is the temperature of the exhaust gases, can be measured and datalogged in MSnS-E code.

FET (field effect transistor) - In MegaSquirt® EFI Controller, the transistors (2) used to control the activation of the injectors.

FIdle - Fast Idle. A device used to control idle speed with additional air supplied by a vacuum solenoid. MegaSquirt has a simple on-off fast idle control, and does not have the ability to drive a PWM IAC (Idle Air Control) device.

Gamma - Used to indicate the ratio of the calculated (or indicated) AFR to the stoichiometric value.

GPIO - (General Purpose Input/Output Board) - A CAN enabled processor equipped expansion board for MegaSquirt-II.

GM - General Motors, the manufacturer for the default coolant and air temperature sensors used with MegaSquirt.

Hall sensor - an "active", magnetic field presence sensor. It is based on the Hall effect. The Hall effect is the change of resistance in a semiconductor in a magnetic field. The Hall effect sensor consists of semiconductor material which will conduct current when the material is subject to a magnetic field. These types of sensors require a "flying magnet", wheel. Instead of teeth on the wheel, as in a variable reluctor sensor, you must have small magnet and a shutter wheel.

HEI - High Energy Ignition, the distributor based electronically controlled ignition system from General Motors. There are a number of variant, identified by the module they use:

High Impedance Injectors - (a.k.a. hi-Z) Fuel injectors designed to work with a simple switch in a 12 volt circuit, no special signal conditioning is required to drive them. The resistance of a high impedance injector is about 10-15 ohms.

HR - (high resolution) the high resolution embedded code that gives higher injector pulse width resolution than the standard B&G embedded code.

Hz (Hertz) the measurement of the frequency of a cyclical event, it represent to number of times per second the cycle is completed.

IAC - Idle Air Controller, though it term is sometimes used more generally, it usually refers to GM's stepper motor controller for additional idle air (and hence engine speed) during warm-up.

IAT sensor - Intake Air Temperature sensor, same as MAT, see below.

IGBT - Insulated Gate Bipolar Transistor a particular kind of transistor especially suitable for driving ignition coils.

kPa (kiloPascals) - the measurement of air pressure used in MegaSquirt® computations. It ranges from 0 (vacuum) to 101.3 kPa (standard atmospheric pressure at sea level) to 250 kPa (21psi of boost) or higher.

Low Impedance Injectors - (a.k.a low-Z) Fuel injectors that are designed to run at a much lower current than would be supplied by a direct 12 volt connection. They require a special signal that is initially at full current (4-6 amps, a.k.a. “peak current”) for about 1.0-1.5 ms, but then drops down to about 1 amp (“hold current”) for the rest of the opening pulse. The resistance of a low-impedance injector is typically 1-3 ohms.

LSU-4 - Bosch wide-band oxygen sensor, planned for use in the Precision Wideband Controller.

MAP sensor - Manifold Absolute Pressure sensor. Measure the absolute pressure in the intake manifold (related to the engine vacuum), to determine the load on the engine and the consequent fueling requirements. The standard MAP sensor in MegaSquirt® is the MPX4250 (2.50 BAR, or 15 psi (vacuum) + 21 psig (boost)).

MAT Sensor - Manifold Air Temperature sensor, the same as IAT. The MAT circuit is identical to the CTS circuit, see CTS, above.

MJL - MegaJolt Lite, used in this document to refer to the ignition supplement to the MegaSquirt® fuel injection controller.

MJLJr - MegaJolt Lite Junior, used in this document to refer to the ignition supplement to the MegaSquirt® fuel injection controller.

MPX4250AP - the internal MAP sensor used in MegaSquirt.

MT - MegaTune, Eric Fahlgren's Windows-based configuration program for the MegaSquirt® EFI controller.

MS - MegaSquirt, used in this document to refer to the MegaSquirt® fuel injection controller or its embedded software.

MSnS-E - MegaSquirt'nSpark-Extra, used in this document to refer to the MegaSquirt and Spark - Extra variant of the MegaSquirt-I fuel injection controller or its embedded software.

MSTweak3000 - a Windows program which will sort through your data logs and calculate VE points that need to be changed.

NB-EGO Sensor - Narrow Band EGO sensor, gives a switch at the stoichiometric ratio (the chemically correct mixture of air and fuel), but unreliable for AFR other than stoichiometric.

OEM (original equipment manufacturer) - refers to parts produced for initial assembly of a new vehicle.

Open Loop - refers to those times when MegaSquirt® ignores the feedback from the oxygen sensor.

PCB (printed circuit board) - the fibreglass board that has the MegaSquirt® component layout and circuits imprinted on it.

PC Configurator (PCC) - The original tuning software from Bowling and Grippo, it has fewer features than MegaTune, and doesn't work with MSnS-E or MegaSquirt-II.

Pull up a very simple circuit consisting of a voltage supply and a current limiting resistor designed to prevent a signal from floating, it forces the signal to either be high (equal to the pull up voltage) or low (grounded).

PW (Pulse Width) is the amount of time a signal is applied during each period. For example, is the the amount of time (in milliseconds) an injector is pulled low (grounded) to injecxt fuel.

P&H Injectors - Peak and hold injectors; see Low Impedance injectors.

PIP - Profile Ignition Pick-up is the term used for the signal sent from Ford's Electronic Distributorless Ignition System (EDIS) to the electronic control unit. This is a digitally modified alternating current (AC) signal that originates from a crank angle sensor. The PIP signal into the ECU is a square wave switched at 12 volts. It provides information about both the engine speed and position.

Pulse Width Modulation (PWM) - A signal with a fixed pulse width (frequency), which is turned on for part of the pulse. The percent of time that the signal is on is called its duty cycle. PWM is used to control voltage (and consequently current) to fuel injectors.

Required Fuel – (Req_Fuel) The injector pulse width, in milliseconds, required to supply the fuel for a single injection event at stoichiometric combustion, 100% volumetric efficiency and standard temperature.

Router Board - The router board is a add-on circuit board for MegaSquirt-II which converts the MegaSquirt-II batch injection pulse to a sequential setup, then 'routes' this pulse to specific injectors based on the instantaneous crank angle (this requires a crank wheel and cam sync).

SAW - Spark Advance Word is the 'returning' signal to a Ford EDIS ignition unit from the ECU that sets the amount of ignition advance requested. It is in the form of a 5 volt square wave.

Stim (">MegaStimulator) - the Stimulator is a small board which plugs into the connector of the MegaSquirt. It simulates all the sensor the inputs the MegaSquirt® would normally see and provides power to the MegaSquirt. The Stimulator also allows you to monitor the MegaSquirt's injection pulses [actual], fuel pump relay operation, and fast idle solenoid output with four LEDs.

SPOUT - Spark Out is the spark advance signal sent from MS-II/MSnS-E to the Ford TFI module to set the timing advance.

TBI - Throttle Body Injection is a form of injection is which the fuel is injected above the throttle(s). It was typically used on older engines since it can be a simpler system, but is also found on some very high output racing engines because the vaporization time is longer than with port injection.

TPI - Tuned Port Injection is General Motors bank-fire port fuel injection system.It was widely used on 305 and 350 cid V8 in the mid to late 1980's.

TPS - Throttle Position Sensor, a voltage divider that gives information to MS about throttle opening, from which it computes rate of throttle opening for acceleration enrichment.

VB921 - a particular IGBT designed for use with automotive ignition coils, it is used with the V3 main board, for example.

VE - Volumetric Efficiency. The actual amount of air being pumped by the engine as compared to its theoretical maximum. A 200 cubic inch motor will theoretically move 200 cubic inches of air in one cycle at 100% efficiency. If the engine is actually running at 75% VE, then it will move 150 cubic inches of air on each cycle.

Vref - a 5 Volt supply used to power the TPS sensor (and sometimes other external components needing a 5 Volt supply, like ignition modules or pull-ups).

VR sensor - variable reluctor sensor is an induction type sensor, it is "passive", i.e. it does not require a power source, and has a small magnet built in.

WB-EGO Sensor - Wide Band EGO sensor, can be used to derive real AFR data with mixtures from 10:1 to 20:1, i.e. anything you are likely to be interested in.

WOT - Wide open throttle.

WUE - Warm Up Enrichment, the enriched mixture applied when the coolant temperature is low.


MegaSquirt Schematics

For the V2.2 main board, load the MegaSquirt® “.pdf” file directly from Bowling and Grippo official MegaSquirt® site by clicking the link.

For the V3 main board see the introduction the the V3 main board.

For MegaSquirt-II see the MegaSquirt-II hardware page.

MegaSquirt Stimulator Assembly Instructions and Schematic

Relay Board Schematic

MegaView Schematic


MegaSquirt 68HC908GP32 Memory Map

$0000 - $003F = I/O Registers: 64 Bytes

$0040 - $023F = RAM 512

$0240 - $7FFF = Unimplemented 32,192 bytes

$8000 - $FDFF = FLASH Memory: 32,256 bytes

$FE00 = SIM Break Status Register (SBSR)

$FE01 = SIM Reset Status Register (SRSR)

$FE02 = Reserved (SUBAR)

$FE03 = SIM Break Flag Control Register (SBFCR)

$FE04 = Interrupt Status Register 1 (INT1)

$FE05 = Interrupt Status Register 2 (INT2)

$FE06 = Interrupt Status Register 3 (INT3)

$FE07 = Reserved (FLTCR)

$FE08 = FLASH Control Register

$FE09 = Break Address Register High (BRKH)

$FE0A = Break Address Register Low (BRKL)

$FE0B = Break Status And Control Register (BRKSCR)

$FE0C = LVI Status Register (LVISR)

$FE0D - $FE0F = Unimplemented: 3 bytes

$FE10 - $FE1F = Unimplemented: 16 bytes Note: Reserved for compatibility with monitor code for A-Family parts

$FE20 - $FF52 = Monitor ROM: 307 bytes

$FF53 - $FF7D = Unimplemented: 43 bytes

$FF7E = Flash Block Protect Register (FLBPR)

$FF7F - $FFDB = Unimplemented: 93 bytes

$FFDC - $FFFF = Flash Vectors: 36 bytes

 

Some MegaSquirt® Assembly Language Variables

ACMULT = Acceleration cold multiplication factor (percent/100)

adsel = ADC Selector Variable

aircor = Air density correction is computed from MAT.

asecount = Counter value for after-start enrichment counter - every ignition

AWC = After-start number of cycles

AWEV = After-start Warmup Percent enrichment add-on value

baro = The barometric pressure as measured by MegaSquirt.

barocor = Barometer Lookup Correction - percent, based on the initial MAP sensor reading.

batt = Battery Voltage ADC Raw Reading - counts

BATTFAC = Battery Gamma Factor

clt = Coolant Temperature ADC Raw Reading - counts (0 - 255)

coolant = Coolant temperature in Degrees F plus 40 (allows -40 degress to fit in integer)

CWH = Crank Enrichment at 170 F

CWU = Crank Enrichment at -40 F

ddra = Port A Data Direction Register

ego = Exhaust Gas Oxygen ADC Raw Reading - counts

egocorr = This is the correction factor computed from O2 sensor readings.

egocount = Counter value for EGO step - incremented every ignition pulse

egotemp = Coolant Temperature where EGO is active

egocountcmp = Counter value where EGO step is to occur

egodelta = EGO Percent step size for rich/lean

egolimit = Upper/Lower EGO rail limit (egocorr is inside 100 +/- Limit)

engine = Variable bit-field to hold engine current status

FASTIDLE = Fast Idle Temperature

gammae = Total Gamma Enrichments - percent

InjOpen = Injector Open Time

InjOCFuel = PW-correlated amount of fuel injected during injector open

INJPWM = Injector PWM duty cycle at current limit

INJPWMT = Injector PWM millisec time at which to activate.

kpa = MAP value in units of KPa

KPARANGEVE = VE Table MAP Pressure Bins for 2_D interp.

last_tps = TPS reading updated every 0.1 seconds

lmap = Manifold Absolute Pressure ADC last Reading

lmat = Manifold Air Temp ADC last Reading

lclt = Coolant Temperature ADC last Reading

ltps = Throttle Position Sensor ADC last Reading

lbatt = Battery Voltage ADC last Reading

lego = Last EGO ADC reading

map = Manifold Absolute Pressure ADC Raw Reading - KPa (0 - 255)

mat = Manifold Air Temp ADC Raw Reading - counts (0 - 255)

mms = 0.0001 second update variable

ms = 0.001 second increment

porta = Port A Data Register

portb = Port B Data Register

portc = Port C Data Register

PRIMEP = Priming pulses (0.1 millisec units)

pulseigncount = Ignition pulse counter

pw = The injector pulse width being used by MS to squirt fuel into your motor.

pwcalc = Computed pulse width - move into variable PW at pulse time

pw = Injector squirt time in 1/10 milliseconds (0 to 25.5 millisec) - applied

pw2= The other PW comparison (injector #2)

pwrun1 = Pulsewidth timing variable 1 - from 0 to 25.5ms

pwrun2 = Pulsewidth timing variable 2 - from 0 to 25.5ms

REQ_FUEL = Fuel Constant

RPMOXLIMIT = Minimum RPM where O2 Closed Loop is Active

rpm = Computed engine RPM - rpm/100

rpmch = Counter for high part of RPM

rpmcl = Counter for low part of RPM

rpmpl = Low part of RPM Period

rpmk = Constant for RPM = 12,000/ncyl - downloaded constant

rpmph = High part of RPM Period

rpmphl = last rpmph value (for odd-fire)

rpmpll = last rpmpl value (for odd-fire)

RPMRANGEVE = VE table RPM Bins for 2-D interpolation

rxoffset = offset placeholder when receiving VE/constants vis. SCI

secl = Time in seconds since MegaSquirt® last booted. Low seconds - from 0 to 255, then

rollover.

sech = High seconds - rollover at 65536 secs (1110.933 minutes, 18.51 hours)

squirt = Event variable bit field for Injector Firing.

tenth = 1/10th second

tmp1,...,tmp19 = Temporary storage.

tps = Throttle Position Sensor ADC Raw Reading - counts, represents 0 - 5 volts

tpsaccel = The acceleration enrichment.

tpsaclk = TPS enrichment timer clock in 0.1 second resolution

TPSAQ = TPS acceleration amount (fn TPSDOT) in 0.1 ms units

tpsacold = Cold acceleration amount (at -40 degrees) in 0.1 ms units

TPSASYNC = TPS Acceleration clock value

TPSDQ = Deacceleration fuel cut

tpsfuelcut = TPS Fuel Cut (percent).

tpsthresh = Accel TPS DOT threshold

txcnt = SCI transmitter count (incremented)

txgoal = SCI number of bytes to transmit

txmode = Transmit mode flag

T1SCX_NO_PWM = No PWM

VE = 64 bytes for VE Table

vecurr = The current computed VE value determined by look up in the VETABLE using

RPM and MAP.

VOLTOXTARGET = O2 sensor flip target value

warmcor = The warmup correction factor applied due to start-up and coolant temperature status.

WWU = Warmup bins (fn temp)

MegaSquirt MC68HC908GP32 Instruction Set

ADC = Add with Carry

ADD = Add without Carry

AIS = Add Immediate Value (Signed) to Stack Pointer

AIX = Add Immediate Value (Signed) to Index Register

AND = Logical AND

ASL = Arithmetic Shift Left

ASR = Arithmetic Shift Right

BCC = Branch if Carry Bit Clear

BCLR n = Clear Bit n in Memory

BCS = Branch if Carry Bit Set

BEQ = Branch if Equal

BGE = Branch if Greater Than or Equal To

BGT = Branch if Greater Than

BHCC = Branch if Half Carry Bit Clear

BHCS = Branch if Half Carry Bit Set

BHI = Branch if Higher

BHS = Branch if Higher or Same

BIH = Branch if IRQ Pin High

BIL = Branch if IRQ Pin Low

BIT = Bit Test

BLE = Branch if Less Than or Equal To

BLO = Branch if Lower

BLS = Branch if Lower or Same

BLT = Branch if Less Than

BMC = Branch if Interrupt Mask Clear

BMI = Branch if Minus

BMS = Branch if Interrupt Mask Set

BNE = Branch if Not Equal

BPL = Branch if Plus

BRA = Branch Always

BRA = Branch Always

BRCLR n = Branch if Bit n in Memory Clear

BRN = Branch Never

BRSET n = Branch if Bit n in Memory Set

BSET n = Set Bit n in Memory

BSR = Branch to Subroutine

CBEQ = Compare and Branch if Equal

CLC = Clear Carry Bit

CLI = Clear Interrupt Mask Bit

CLR = Clear

CMP = Compare Accumulator with Memory

COM = Complement (Ones Complement)

CPHX = Compare Index Register with Memory

CPX = Compare X (Index Register Low) with Memory

DAA = Decimal Adjust Accumulator

DBNZ = Decrement and Branch if Not Zero

DEC = Decrement

DIV = Divide

EOR = Exclusive-OR Memory with Accumulator

INC = Increment

JMP = Jump

JSR = Jump to Subroutine

LDA = Load Accumulator from Memory

LDHX = Load Index Register from Memory

LDX = Load X (Index Register Low) from Memory

LSL = Logical Shift Left

LSR = Logical Shift Right

MOV = Move

MUL = Unsigned Multiply

NEG = Negate (Twos Complement)

NOP = No Operation

NSA = Nibble Swap Accumulator

ORA = Inclusive-OR Accumulator and Memory

PSHA = Push Accumulator onto Stack

PSHH = Push H (Index Register High) onto Stack

PSHX = Push X (Index Register Low) onto Stack

PULA = Pull Accumulator from Stack

PULH = Pull H (Index Register High) from Stack

PULX = Pull X (Index Register Low) from Stack

ROL = Rotate Left through Carry

ROR = Rotate Right through Carry

RSP = Reset Stack Pointer

RTI = Return from Interrupt

RTS = Return from Subroutine

SBC = Subtract with Carry

SEC = Set Carry Bit

SEI = Set Interrupt Mask Bit

STA = Store Accumulator in Memory

STHX = Store Index Register

STOP = Enable IRQ Pin, Stop Oscillator

STX = Store X (Index Register Low) in Memory

SUB = Subtract

SWI = Software Interrupt

TAP = Transfer Accumulator to Processor Status Byte

TAX = Transfer Accumulator to X (Index Register Low)

TPA = Transfer Processor Status Byte to Accumulator

TST = Test for Negative or Zero

TSX = Transfer Stack Pointer to Index Register

TXA = Transfer X (Index Register Low) to Accumulator

TXS = Transfer Index Register to Stack Pointer

WAIT = Enable Interrupts; Stop Processor


Programming a Blank MS-I Processor

The steps to program a blank processor (i.e. not a group buy unit) are listed below. Make sure you have the latest version of the Prog08sz software. Get the latest version at http://groups.yahoo.com/group/68hc908pgm/ files/software/prog08sz.zip.

1. For MegaSquirt® code (not Tomtek ignition), download the megasquirt.s19 file(s) you wish to use OR assemble megasquirt.asm(or megasquirtDT.asm, etc.) into its respective “.s19” file. See how to do this in the “CODE” section of the MegaSquirt® FAQ. (Tomtek ignition code, dual table MS code, and version 2 and later standard MegaSquirt® code already contain the boot loader, so you only need to assemble the megasquirt.asm file.)

2. Start up prog08sz, you might have to retry several times to connect. If you cannot get a connection, read the 908 archives for some hints on debugging.

3. Often the connect problem is low voltage due to a wimpy serial port, so you might want to eliminate this problem by connecting an external power source. (e.g., a 9 volt battery) to the circuit. Connect the positive (+) side of the battery to the banded side of D2 (or D1) and the negative (-) side to a ground point (e.g., the mounting lug on the 9 pin connector).

4. Select the 908_gp32.08p module when asked to "Specify Programming Algorithm to Use".

5. If this chip has been programmed before, you need to erase it (if in doubt, do this anyhow). Click on the button with the “pencil erasing” icon (6th from the left) to Erase Module. When this is done, it says "Erasing. Module has been erased" in the lower left corner of the screen, after which you should verify the chip with Blank Check Module (the button beside Erase Module). You should get a message saying "Erased."

6. For version 1.0 of the code only, click on "SS Specify S Record" in the window on the middle left [or the 19diskette19 button in the menu], and select "boot_r12.s19".
Note that Version 2 and later .s19 files include the boot_r12 file, and this step should be skipped. Click on "Program Module" [on the menu on the left, or use the button beside the “diskette”/Specify Recordbutton]. After a few seconds, it should complete. Then you can then click on "VM Verify Module" [on the menu on the left, or use the button beside the “Program Module” button]. You should get a message that the module was “verified”.

7. Click on Specify S Record as above, this time selecting "megasquirt.s19" Follow this with "Program Module", then "Verify Module".

8. Disconnect the serial cable from the programmer, unlatch the ZIF lever, remove the chip, and you should be ready to insert the chip into a MegaSquirt® controller and run.



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.
©2004, 2005 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.