Subject: EFI software 101 Lesson 2
From: Rotary Engine
Date: 3/22/2009, 8:23 AM
To: AAA Put this in the To box


Probably the easiest way for me to explain
EFI software is to look at the early
Megasquirt software written in straight forward
assemble language. Assembly language is a very mechanical
thing. It is well adapted to controlling mechanical
devices. Assembly language is close to a one to one correspondence
between computer instructions and computer operations. Assembly language
programming also gives direct access to key machine features such
as sensors and injectors.

Computers are set up like post offices. There
are many numbered boxes. Each box is an address.
The boxes can also have names such as "bank".
It is easier for the programmer to remember
"bank" than box #8765. These boxes are also
known as memory locations.

MAP sensors look just like a PO box after the analog
data is converted to digital. The analog to digital
converter (ADC) is a black box electronic device that takes
in a zero to 5 volt analog voltage and puts a number 0 to 63
into a PO box maybe called the MapSensorBox. This is called
memory mapped Input Output or I/O for short.

Let me give you a simple example.
The LDA instruction moves 8 bits of data (64 combinations of
eight zeros and ones 01001110) from one specified box to another.
Here is what it looks like on paper in the program listing.

LDA MapSensorBox

Translated it means LoaD (really copy) what is in the MapSensorBox
to another box called the Accumulator box. This instruction
could take way less than one micro second (usec) to complete
in a fast computer. One will know exactly HOW FAST in case
time to achieve something is important to one. That is
usually the case when controlling a high speed machine
such as an engine.

This is probably the most frequently used instruction
you will find. With several more simple instructions
like this, one can write programs that do useful things.
Especially if one is controlling a machine.

That is all there is to it. No more complicated than
that. In the next lesson we will cover the STA instruction.
Another highly used instruction.

----------------------------------------------------------

Before we get to the STA instruction we need a bit more info
on LDA. I lied.

There is another aspect to the LDA instruction and that
is a thing called addressing modes. What we have shown
so far is only one of several options for the LDA instruction.
The first copies data from a box anywhere in memory and that
includes input boxes. Probably the most used of all the
four LDA addressing modes and the one you have learned so far.

Another mode is called the immediate mode. Lets say
I wanted to enter a number directly into the A box.
I would use this form:
LDA    #$06

The # (pound sign) tells the assembler program the next number
it sees in the listing is the number one wants to load into the A box.
The dollar sign means it is a decimal number in the range
of 0 to 63. The computer really only deals with binary
numbers. The assembler program reads the decimal number
from our listing and converts it to a binary number.

If I wanted to load the A box with a binary
number directly I would use this form. A binary number composed
of ones and zeros. Â The % sign tells the assembler program
it is a binary number.

LDA    #%00001000

The fourth bit is set reading from right to left. (Unfortunately
ass backwards :)) Handy if we want to set one or more bits
in some box someplace including a hardware output box.

Here is a table that converts decimal numbers to binary.
We will get into the other more advanced modes later.


Paul Lamar


Paul,

You aren't saying

LDA    #%00001000

is equal to

LDA    #$06

are you?

6 (decimal or hex) is 110 in binary.

Matt-

No! It would be LDA #%00000110

Good going Matt! Your paying attention.

My ultimate goal here is to show how to use
a single chip computer to rapidly fire a multiple capacitor..
capacitor discharge ignition system. Perhaps advance
the spark as well.

Paul Lamar

-- 
The Rotary Engine NewsLetter. Powered by Linux.
ACRE NL web site. http://www.rotaryeng.net
Youtube key word UTUBPLEASE
Copyright 1998-2008 All world wide rights reserved.